Skip to content
Please note that GitHub no longer supports your web browser.

We recommend upgrading to the latest Google Chrome or Firefox.

Learn more
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible bug when vce="bootstrap" and glmerMod object. #105

Closed
jeffmax opened this issue Nov 2, 2018 · 1 comment · Fixed by #117
Closed

Possible bug when vce="bootstrap" and glmerMod object. #105

jeffmax opened this issue Nov 2, 2018 · 1 comment · Fixed by #117
Labels

Comments

@jeffmax
Copy link

@jeffmax jeffmax commented Nov 2, 2018

Please specify whether your issue is about:

  • a possible bug
  • a question about package functionality
  • a suggested code or documentation change, improvement to the code, or feature request

If you are reporting (1) a bug or (2) a question about code, please supply:

  • a fully reproducible example using a publicly available dataset (or provide your data)
  • if an error is occurring, include the output of traceback() run immediately after the error occurs
  • the output of sessionInfo()

Put your code here:

## load package
library("margins")
library(lme4)

## code goes here
d=data.frame(cat=c(1,0,0,1), bird=c(1,0,2,1), room=c(1,1,0,0))
m=glmer(cat~bird + (1 | room), data=d, family=binomial(link="logit"))
margins(m, vce="bootstrap", iterations=999)

## session info for your system
R version 3.5.1 (2018-07-02)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux

Matrix products: default
BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8
 [8] LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] lme4_1.1-18    Matrix_1.2-14  margins_0.3.23

loaded via a namespace (and not attached):
 [1] minqa_1.2.4       MASS_7.3-50       .py_0.1.3         compiler_3.5.1    tools_3.5.1       Rcpp_0.12.18      splines_3.5.1     nlme_3.1-137      grid_3.5.1        data.table_1.11.4
[11] nloptr_1.0.4      lattice_0.20-35   prediction_0.3.6

Error is:

Error in `*tmp*`[["call"]] : this S4 class is not subsettable

Traceback:

> traceback()
12: bootfun()
11: FUN(X[[i]], ...)
10: lapply(X = X, FUN = FUN, ...)
9: sapply(integer(n), eval.parent(substitute(function(...) expr)),
       simplify = simplify)
8: replicate(iterations, bootfun())
7: t(replicate(iterations, bootfun()))
6: is.data.frame(x)
5: var(t(replicate(iterations, bootfun())))
4: get_effect_variances(data = data, model = model, variables = variables,
       type = type, vcov = vcov, vce = vce, iterations = iterations,
       weights = weights, eps = eps, varslist = varslist, ...)
3: build_margins(model = model, data = data_list[[i]], variables = variables,
       type = type, vcov = vcov, vce = vce, iterations = iterations,
       unit_ses = unit_ses, eps = eps, varslist = varslist, ...)
2: margins.merMod(m, vce = "bootstrap", iterations = 999)
1: margins(m, vce = "bootstrap", iterations = 999)
@jacob-long

This comment has been minimized.

Copy link
Contributor

@jacob-long jacob-long commented Feb 18, 2019

Very similar problem for vce = "simulation".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.