preProcess in caret function is not giving expected results

caret function does not seem to center and scale?

boxplot(pV,main="Raw Data")
#Center and Scale all x variables == Standardizing
library(caret)
range(pV$x5)
preObj <- preProcess(pV, method = c("center", "scale"))
preObjData <- predict(preObj,pV)
boxplot(preObjData, main="Normalized data" )

Output is out of expected ranges? I cannot upload csv file or I would.

pV
x1 x2 x3 x4 x5 x6 x7 ... x8 x9 x10 x11
1 7.4 0.66 0.00 1.8 0.075 13 40 0.9978 3.51
2 7.8 0.58 0.02 2.0 0.073 9 18 0.9968 3.36
3 6.7 0.58 0.08 1.8 0.097 15 65 0.9959 3.28
4 8.9 0.62 0.18 3.8 0.176 52 145 0.9986 3.16
5 8.1 0.56 0.28 1.7 0.368 16 56 0.9968 3.11
6 7.4 0.59 0.08 4.4 0.086 6 29 0.9974 3.38

Can you help? Thank you.

Do a reprex. See the FAQ like the one below using your data in place of the fake version?

library(caret)
#> Loading required package: ggplot2
#> Loading required package: lattice
set.seed(42)
bucket <- sample(seq(0, 600, 0.1), 110)
pV <- data.frame(
  x1 = bucket[1:10],
  x2 = bucket[11:20],
  x3 = bucket[21:30],
  x4 = bucket[31:40],
  x5 = bucket[41:50],
  x6 = bucket[51:60],
  x7 = bucket[61:70],
  x8 = bucket[71:80],
  x9 = bucket[81:90],
  x10 = bucket[91:100],
  x11 = bucket[101:110]
)

range(pV$x5)
#> [1]  62.5 435.7
boxplot(pV,main="Raw Data")

preObj <- preProcess(pV, method = c("center", "scale"))
preObjData <- predict(preObj,pV)
boxplot(preObjData, main="Normalized data" )

Created on 2023-01-30 with reprex v2.0.2

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.