Dear R users,I'm a new user of R. I'm trying to do a LM test an there is this 
type of error: Error in t(mX) %*% mX : requires numeric/complex matrix/vector 
arguments.
To be clear I write down the code in which mY ( 126,1 )   mX (126,1)   
mZ(126,1) are matrix.

LMTEST <- function(mY, mX, mZ)#mY, mX, mZ must be matrices!#returns the LM test 
statistic and the degree of freedom{iT = dim(mY)[1]ip = dim(mY)[2]iDF = 
dim(mZ)[2]*ipmE = mY - mX%*%solve(t(mX)%*%mX)%*%t(mX)%*%mY
the error starts from the above step     (t(mX)%*%mX)%*%t(mX)%*%mY
RSS0 = t(mE)%*%mEmXX = cbind(mX, mZ)mK = mE - 
mXX%*%solve(t(mXX)%*%mXX)%*%t(mXX)%*%mERSS1 = t(mK)%*%mKdTR = 
sum(diag(solve(RSS0)%*%RSS1))LM = iT*(ip-dTR)pval = 1-pchisq(LM,df=iDF)return( 
c(pval, LM, iDF) )}
Any suggestion? Where is the problem? I am getting craxy!
Valentina                                         
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to