1 Estandarización

1.1 Score-Z

\[ Z = \frac{x - \mu}{\sigma} \]

Nota: X = variable de interes. \(\mu\) = La media de los datos. \(\sigma\) = desviación estandar

1.2 Usando R para estandarizar una variable

set.seed(123)

X = rnorm(n = 60,mean = 3,sd = 0.3)
head(X)
## [1] 2.831857 2.930947 3.467612 3.021153 3.038786 3.514519
hist(X)
abline(v = mean(X),
       col = "red",
       lwd = 3,
       lty = 3)

boxplot(X)
points(mean(X),
       col = "tomato",
       cex = 1.5,
       pch = 16)

set.seed(123)
Y = rexp(n = 600,rate = 1/2)
head(Y)
## [1] 1.68691452 1.15322054 2.65810974 0.06315472 0.11242195 0.63300243
boxplot(Y)
points(mean(Y),
       col = "orange",
       cex = 1.5,
       pch = 16)

hist(Y)
abline(v = mean(Y),
       col= "red",
       lty = 3,
       lwd = 3)

1.3 AHora si score-Z de la variable X

z_x = scale(X)
head(z_x)
##              [,1]
## [1,] -0.687729949
## [2,] -0.324914908
## [3,]  1.640081452
## [4,]  0.005372616
## [5,]  0.069938613
## [6,]  1.811830980
par(mfrow = c(1,2))
hist(X, nclass = 10)
hist(z_x, nclass = 10)

plot(X, z_x)

### correlacion de pearson

cor(x = X,y = z_x ,method = "pearson")
##      [,1]
## [1,]    1

1.4 Transformaciones lineales

\[ Aditiva \\ T(X_1 + X_2) = T(X_1)+T (X_2) \\ Homogénea \\ T(c*X) = c*T(X) \]