Displaying 2 results from an estimated 2 matches for "frxy".
Did you mean:
frey
2005 Mar 24
1
RE: [R] Mapping actual to expected columns for princomp object
...;
> If so, can anyone tell me how to accomplish steps 1 and 2 above?
>
> Thanks,
> Dana Honeycutt
>
> P.S. Here's a script that demonstrates the problem:
>
> x1 <- rnorm(10)
> x2 <- rnorm(10)
> y <- rnorm(10)
>
> frx <- data.frame(x1,x2)
> frxy <- data.frame(x1,x2,y)
>
> lm1 <- lm(y~x1+x2,frxy)
> pca1 <- princomp(frx)
>
> rm(x1,x2,y,frx,frxy)
>
> z1 <- rnorm(10)
> z2 <- rnorm(10)
> frz <- data.frame(z1,z2)
>
> predict(lm1, frz) # gives error: Object "x1" not found
> pred...
2005 Mar 24
0
Mapping actual to expected columns for princomp object
...a set.
Is this the best approach to achieve what I am attempting?
If so, can anyone tell me how to accomplish steps 1 and 2 above?
Thanks,
Dana Honeycutt
P.S. Here's a script that demonstrates the problem:
x1 <- rnorm(10)
x2 <- rnorm(10)
y <- rnorm(10)
frx <- data.frame(x1,x2)
frxy <- data.frame(x1,x2,y)
lm1 <- lm(y~x1+x2,frxy)
pca1 <- princomp(frx)
rm(x1,x2,y,frx,frxy)
z1 <- rnorm(10)
z2 <- rnorm(10)
frz <- data.frame(z1,z2)
predict(lm1, frz) # gives error: Object "x1" not found
predict(pca1, frz) # gives no error, indicating column names ign...