[R] out of sample predictions using a probit model

BrysonHH Bryson.Hadley at gmail.com
Sat Aug 27 00:18:54 CEST 2011


hello all,

I am a beginner at R and not exactly a statistician either. I'm messing
around with a probit model on an enconomic time series. I can get the model
estimated but I have not been able to get it to give me predictions out of
sample data. I'm using the predict function but getting errors. Here is my
code:

#predict a recession 12 months out 
#k=12 means 12 months forward
#dates must be trimmed manually
recession.probModel <- glm(formula =
window(lag(recession.TS,k=12),start=c(1986,2)) ~
window(FEDFUNDS.TS,start=c(1986,2),end=c(2010,7)) 
+ window(sp500Ret.TS,end=c(2010,7))+
window(CurveSlope.TS,start=c(1986,2),end=c(2010,7)) 
+ window(CreditSpread.TS,start=c(1986,2),end=c(2010,7)) +
window(NAPM.TS,start=c(1986,2),end=c(2010,7))
+ window(MCOILWTI.TS,start=c(1986,2),end=c(2010,7))
, family=binomial(link="probit"))

predict(recession.probModel,window(full.TS,start=c(2010,8)),
type="response")

The GLM model works fine, but the predict function throws the following
error:

Error in window.default(FEDFUNDS.TS, start = c(1986, 2), end = c(2010,  : 
  'start' cannot be after 'end'
In addition: Warning message:
In window.default(FEDFUNDS.TS, start = c(1986, 2), end = c(2010,  :
  'end' value not changed

Can someone let me know why I am getting this error and what to do about it?
Thanks, Bryson

--
View this message in context: http://r.789695.n4.nabble.com/out-of-sample-predictions-using-a-probit-model-tp3772175p3772175.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list