Re: [Rd] prcomp with previously scaled data: predict with 'newdata' wrong

2012-05-23 Thread Jari Oksanen
r-project.org] on behalf of Jari Oksanen [jari.oksa...@oulu.fi] Sent: 23 May 2012 13:51 To: r-de...@stat.math.ethz.ch Subject: [Rd] prcomp with previously scaled data: predict with 'newdata' wrong Hello folks, it may be regarded as a user error to scale() your data prior to

[Rd] prcomp with previously scaled data: predict with 'newdata' wrong

2012-05-23 Thread Jari Oksanen
Hello folks, it may be regarded as a user error to scale() your data prior to prcomp() instead of using its 'scale.' argument. However, it is a user thing that may happen and sounds a legitimate thing to do, but in that case predict() with 'newdata' can give wrong results: x <- scale(USArrests