search for: rhoe

Displaying 1 result from an estimated 1 matches for "rhoe".

Did you mean: rhce
2012 Jul 26
1
loop for, error: obj type 'closure' not subsetable
...n very matrix row there is two coefficients b0 and b1. The vectors are two variables x and y. I want to do a loop to take b0 and b1 and with x and y calculate the residual of a linear model and calculate the second order coefficient of autocorrelation. What I did is : rho<-function(mat, x,y){ rhoes=rep(0,dim(mat)[1]) for (i in 1:dim(mat)[1]){ rhoes[i]=acf(y-(mat[i,1]+mat[i,2]*x),type="correlation",plot=FALSE)$acf[2] #explanation below } print(rho[i]) } I'm getting this error: Error in rho[i] : object of type 'closure' is not subsettable...