Open jonlatner opened 5 years ago
Please specify whether your issue is about:
There appears to be a new issue with combining clustered standard error with miceadds and margins.
As published in the following two links, the code below used to work, but not any more:
https://stackoverflow.com/questions/51260518/how-to-get-the-marginal-effects-after-lm-robust-with-clustered-standard-errors https://github.com/leeper/margins/issues/97
The following code produces the following error: Error in data[[variable]] : object of type 'closure' is not subsettable
Put your code here:
## load package library("margins") library(fabricatr) library(randomizr) library(miceadds) ## code goes here set.seed(42) dat <- fabricate( N = 100, # sample size x = runif(N, 0, 1), # pre-treatment covariate y0 = rnorm(N, mean = x), # control potential outcome y1 = y0 + 0.35, # treatment potential outcome z = complete_ra(N), # complete random assignment to treatment y = ifelse(z, y1, y0), # observed outcome # We will also consider clustered data clust = sample(rep(letters[1:20], each = 5)), z_clust = cluster_ra(clust), y_clust = ifelse(z_clust, y1, y0) ) lmout_cl <- lm.cluster(y_clust ~ z_clust + x, data=dat, cluster="clust") mar_cl <- with(lmout_cl, margins(lm_res, vcov=vcov)) ## session info for your system sessionInfo() R version 3.6.0 (2019-04-26) Platform: x86_64-apple-darwin15.6.0 (64-bit) Running under: macOS Mojave 10.14.5 Matrix products: default BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] margins_0.3.23 miceadds_3.3-33 mice_3.5.0 lattice_0.20-38 randomizr_0.18.0 fabricatr_0.8.0
This is not a supported model type currently.
Please specify whether your issue is about:
There appears to be a new issue with combining clustered standard error with miceadds and margins.
As published in the following two links, the code below used to work, but not any more:
https://stackoverflow.com/questions/51260518/how-to-get-the-marginal-effects-after-lm-robust-with-clustered-standard-errors https://github.com/leeper/margins/issues/97
The following code produces the following error: Error in data[[variable]] : object of type 'closure' is not subsettable
Put your code here: