statVec {propagate}R Documentation

Transform an input vector into one with defined mean and standard deviation

Description

Transforms an input vector into one with defined \mu and \sigma by using a scaled-and-shifted Z-transformation.

Usage

statVec(x, mean, sd)

Arguments

x

the input vector to be transformed.

mean

the desired mean of the created vector.

sd

the desired standard deviation of the created vector.

Details

Calculates vector V using a Z-transformation of the input vector X and subsequent scaling by sd and shifting by mean:

V = \frac{X - \mu_X}{\sigma_X} \cdot \rm{sd} + \rm{mean}

Value

A vector with defined \mu and \sigma.

Author(s)

Andrej-Nikolai Spiess

Examples

## Create a 10-sized vector with mean = 10 and s.d. = 1.
x <- rnorm(10, 5, 2)
mean(x) ## => mean is not 5!
sd(x) ## => s.d. is not 2!

z <- statVec(x, 5, 2)
mean(z) ## => mean is 5!
sd(z) ## => s.d. is 2!

[Package propagate version 1.0-6 Index]