You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying add_ci on a model with a formula involving I(...), i.e.
library(ciTools)
library(lme4)
data <- data.frame(x = c(1, 2, 3, 4), y = c(1, 3, 10, 15), gr = (1, 1, 2, 2))
mod <- lmer(y ~ I(x^2) + (1|gr), data)
add_ci(data, mod)
results in Error in x^2: non-numeric argument to binary operator. Attempting add_ci(data, mod, type = "parametric") results in Error in `[[<-.data.frame`(`*tmp*`, names[1], value = numeric(0)) : replacement has 0 rows, data has 4. The code completes in other cases, but returns spurious confidence intervals and the warning longer object length is not a multiple of shorter object length. At least in the parametric case, the problem appears to be in get_x_matrix_mermod.
Trying add_ci on a model with no fixed effects, i.e.
data <- data.frame(x = rep(seq(5), 2), y = c(rnorm(5), rnorm(5, mean = 0.5)), gr = c(rep(1, 5), rep(2, 5)))
mod <- lmer(y ~ (1 | gr), data)
data %>% add_ci(mod, type = "parametric")
results in Error in reformulate(attributes(terms(fit))$term.labels) : 'termlabels' must be a character vector of length at least one. Again, the problem appears to be in get_x_matrix_mermod.
The text was updated successfully, but these errors were encountered:
andercolin
changed the title
add_ci.lmer fails or returns invalid results for models with formulas involving I(...)
add_ci.lmer is not robust to formula types
Jul 11, 2019
Trying
add_ci
on a model with a formula involvingI(...)
, i.e.results in
Error in x^2: non-numeric argument to binary operator
. Attemptingadd_ci(data, mod, type = "parametric")
results inError in `[[<-.data.frame`(`*tmp*`, names[1], value = numeric(0)) : replacement has 0 rows, data has 4
. The code completes in other cases, but returns spurious confidence intervals and the warninglonger object length is not a multiple of shorter object length
. At least in the parametric case, the problem appears to be inget_x_matrix_mermod
.Trying
add_ci
on a model with no fixed effects, i.e.results in
Error in reformulate(attributes(terms(fit))$term.labels) : 'termlabels' must be a character vector of length at least one
. Again, the problem appears to be inget_x_matrix_mermod
.The text was updated successfully, but these errors were encountered: