| statVec {propagate} | R Documentation |
Transforms an input vector into one with defined μ and σ by using a scaled-and-shifted Z-transformation.
statVec(x, mean, sd)
x |
the input vector to be transformed. |
mean |
the desired mean of the created vector. |
sd |
the desired standard deviation of the created vector. |
Calculates vector V using a Z-transformation of the input vector X and subsequent scaling by sd and shifting by mean:
V = \frac{X - μ_X}{σ_X} \cdot \rm{sd} + \rm{mean}
A vector with defined μ and σ.
Andrej-Nikolai Spiess
## 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!