Displaying 1 result from an estimated 1 matches for "myfn1".
Did you mean:
myfn
2010 Jan 13
1
Rollapply
...77.35,76.72,77.49,78.70,77.78,79.58))
data.z = zoo(d)
test1 = rollapply(data.z, width=3,
FUN = function(z) coef(lm(z[,1]~z[,2],
data=as.data.frame(z))), by.column = FALSE, align = "right")
print(test1)
######################################
Rewriting this to call myfn1 gives test2 (and is consistent with test1
above)
myfn1 = function(mydata){
dd = as.data.frame(mydata)
l = lm(dd[,1]~dd[,2], data=dd)
c = coef(l)
}
test2 = rollapply(data.z, width=3,
FUN= myfn1, by.column = FALSE, align = "right")
print(test2)
#############...