[R] predict assistance

Michaell Taylor pols1oh at bestweb.net
Wed May 1 23:24:34 CEST 2002



I have a question regarding application of model coefficients between 
datasets.  In particular, I have several datasets which I would like to apply 
a model estimated from only a single dataset (sort of a crude - out of sample 
application - to show the variances).

lets say,
names(a)
[1] "stdnoi"   "momentum" "tbm3"     "metcons"  "premium"  "STDrfa"   "t10" 
"Y"
attach(a)
mymodel <- lm(Y ~ stdnoi+momentum+tbm3+metcons+premium+ STDrfa +   t10)
detach(a)
load('b')
names(b)
[1] "stdnoi"   "momentum" "tbm3"     "metcons"  "premium"  "STDrfa"   "t10" 
"Y"
attach(b)
b$hat <- predict(mymodel)

The question really is, is b$hat properly defined in terms of (a)coefficients 
* (b)variables?

I have attempted this, and was surprised to see b$hat of the appropriate 
length for the a dataset - but not the b (which is much larger)

Obviously I could save out the coefficients, but there are actually several 
such models and datasets.  Besides, I am generally curious if model objects 
can be used in such a manner.


=========================================
Michaell Taylor, PhD

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list