r - Convert normalized variables back to non-normalized values -
i built kmeans cluster first normalized several of variables in r. model provides me cluster centers, in normalized state (like center of income -1.6).
i want convert -1.6 non-normalized value able give practical meaning (like income 42,000).
now can individually convert z-score value, there way several normalized variables r function?
i can start pnorm() percentage- looking more can apply original dataframe before normalized it.
it might easiest calculate means of (raw) data once have cluster assignments. example, using plyr:
# install.packages('plyr') require(plyr) dat <- mtcars[,1:4] dat$cvar <- kmeans(scale(dat), 3)$cluster ddply(dat, c("cvar"), colwise(mean)) cvar mpg cyl disp hp 1 1 13.41429 8.000000 390.5714 248.42857 2 2 23.97222 4.777778 135.5389 98.05556 3 3 16.78571 8.000000 315.6286 170.00000
Comments
Post a Comment