I calculated a weighted logit model with the "survey" package.
library(survey)
Mod_design <- svrepdesign(variables = Data,
weights = weights,
repweights = REP_WGT,
type = "JKn",
scale = 1,
rscales = 1)
Mod <- svyglm(Education ~
Sex + Age + Edu_Parents,
family = quasibinomial, design = Mod_design)
Now I would like to calculate marginal effects for this model. Without weights, I would usually use the logitmfx function of the mfx package. Unfortunately, it is not possible to calculate marginal effects for weighted models with this package and so far I couldn't find a way how I could handle this problem.
Is there a way how I could calculate marginal effects for weighted models?
您可以使用以下代码从 R 包survey
通过svyglm
估计的模型获得边际效应:
summary(margins(MODEL_NAME, variables = "VARIABLE_OF_INTEREST", design=YOUR_DESIGN))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.