Given the "mlm" model object, you can use the following function, written by me, to get standard coefficient errors. This is very effective: there is no loop and no access to summary.mlm() .
std_mlm <- function (model) { Rinv <- with(model$qr, backsolve(qr, diag(rank)))
Simple, reproducible example
set.seed(0) Y <- matrix(rnorm(50 * 5), 50)
We all know that simply extracting the estimated coefficients through:
fit$coefficients
Now apply our std_mlm :
std_mlm(fit) # [,1] [,2] [,3] [,4] [,5] #(Intercept) 0.1297150 0.1400600 0.1558927 0.1456127 0.1186233 #X 0.1259283 0.1359712 0.1513418 0.1413618 0.1151603
We can, of course, call summary.mlm only to verify the correctness of our result:
coef(summary(fit))
Yes everything is correct!
source share