Displaying 1 result from an estimated 1 matches for "myres1".
Did you mean:
myreg1
2004 Mar 19
2
using "unstack" inside my function: that old scope problem again
...can't understand the answers. Can
one of you try to explain this to me?
Here's my example. Given a regression model and a variable, I want to
use unstack() on the vector of residuals and make some magic with the
result. But unstack hates me.
PCSE <- function (tmodel,groupVar) {
myres1 <- resid(tmodel)
resUnstacked <- unstack(myres1, form = myres1 ~ groupVar));
E <- as.matrix(resUnstacked)
SIGMA <- (1/nrow(E))*(t(E) %*% E)
OMEGA <- diag(x=1, nrow=nrow(E), ncol=nrow(E)) %x% SIGMA
X <- model.matrix(tmodel)
XPRIMEXINV <- solve(t(X) %*% X)
PCSECOVB...