Pergunta

When using the R package MuMIn (v1.9.5), and the command dredge, the beta = TRUE switch no longer functions as expected.

# load Cement data set with MuMIn package
data(Cement)

# build global model
fmd <- lm(y ~ X1 + X2 + X3 + X4, data = Cement)

# dredge global model without returning standardized coefficients (default); 
# WORKING

ms1 <- dredge(fmd)

# dredge global model and return standardized coefficients; 
# NOT WORKING

ms1 <- dredge(fmd, beta = TRUE)

The latter returns:

Error in dimnames(ret) <- list(names(model$coefficients), c("Estimate",  : 
  length of 'dimnames' [1] not equal to array extent

Using R v3.0.0

Foi útil?

Solução

Confirmed with MuMIn 1.9.5 ... it looks like there is a bug in the beta.weights() function.

The fourth line,

 coefmat <- coefTable(model)[, 1L:2L]

should be

 coefmat <- coefTable(model)[, 1L:2L, drop=FALSE]

You can fix this for yourself, temporarily, as follows:

fix(beta.weights)
## opens an editor; make the change in the editor and save/exit
assignInNamespace("beta.weights",beta.weights,"MuMIn")

However, it would definitely be a good idea to contact the package maintainer (see help(package="MuMIn") and submit a bug report ...

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top