Displaying 1 result from an estimated 1 matches for "myfn2".
Did you mean:
myfn
2010 Jan 13
1
Rollapply
...wdata' had 1 row but variable(s)
found have 3 rows.
(if I run this outside of rollapply I don't get this warning)
Also, I don't see the predicted value or its se with print(fm2[[1]]). Again,
if I run this outside of rollapply I am able to extract the predicted value.
Xpred=c(70.67)
myfn2 = function(mydata){
dd = as.data.frame(mydata)
l = lm(dd[,1]~dd[,2], data=dd)
c = coef(l)
p = predict(l, data.frame(Xvar=Xpred),se=T)
ret=c(l,c,p)
}
fm2 = rollapply(data.z, width=3,
FUN= myfn2, by.column = FALSE, align = "right")
print(fm2[[1]])...