[R] Computing predictive values

steve tom sellio04 at uoguelph.ca
Sun Mar 30 13:34:42 CEST 2014


Here is my current process:

x.sub<- subset(Model.Update, Row <200& Row >0) # INITIAL SAMPLE 
x.sub1<-subset(Model.Update, Row <206& Row >200) # Subset into lots of 5
until current period - 5 period 
...                                                                                                                    
update frequency
x.subn<-subset(Model.Update, Row <XXX & Row >XXX)                                             

# Run regressions
A1<-lm(y ~ x + z, data=x.sub)  # Will forecast 200 to 205
A2<-lm(y ~ x + z, data=x.sub1)   # will forecast 206 to 210
...
An<-lm(y ~ x + z, data=x.subn)

name<-predict(A1,x.sub1)    # Make predictions for subset
...        
namen<-predict(An,x.subn) 

Then export to excel. 
write.csv(name,file="1.csv")
write.csv(namen,file="n.csv")


Seems like there must be an easier way then creating hundreds of subsets. I
build all my lines in excel, concatenate, then copy and paste into R to save
time.

Cheers

Steve




--
View this message in context: http://r.789695.n4.nabble.com/Computing-predictive-values-tp4687832p4687844.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list