[R] confint() on mlm object requires named response matrix

iiori@@@wickeim@ier m@iii@g oii u@i-tuebi@ge@@de iiori@@@wickeim@ier m@iii@g oii u@i-tuebi@ge@@de
Sat Feb 27 17:36:59 CET 2021

Dear list,

I fit a multivariate model and want to extract univariate confidence
intervals from the mlm object. If the response matrix is unnamed,
confint() just repeats the first interval. If the response matrix is
named, confint() correctly returns CIs for all columns:

Y <- MASS::mvrnorm(10, c(0, 0), diag(2)) # unnamed response matrix

confint(lm(Y ~ 1))
                   2.5 %    97.5 %
:(Intercept) -0.7069968 0.2783868
:(Intercept) -0.7069968 0.2783868        # incorrect, same as first CI

colnames(Y) <- 1:2                       # named response matrix
confint(lm(Y ~ 1))
                    2.5 %     97.5 %
1:(Intercept) -0.7069968  0.2783868
2:(Intercept) -0.9226622 -0.1208534      # correct

Is this intended behavior of confint()? I think it would be great if the
unnamed case gave a warning. Or am I missing something?

Best, Florian

Florian Wickelmaier
Department of Psychology
University of Tuebingen

More information about the R-help mailing list