Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [r-marginaleffects]

marginaleffects is an R package for computing and plotting adjusted predictions, contrasts, marginal effects, and marginal means.

r-marginaleffects
0 votes
1 answer
19 views

marginaleffects R package: correct syntax for predictions function using map

I am trying to compute predictions using the R::marginaleffects package. I would like to do this several times for specific predictor variables of interest, within a map / apply like function, but am ...
user167591's user avatar
0 votes
2 answers
46 views

Different outputs of marginaleffects::avg_prediction and ggeffects::ggeffect in R

I am running multinomial regression using nnet::multinom for a dataset where response and predictors are all factors. A sample of my data: df2 = structure(list(SOURC = c("dsint", "dsint&...
Shakir's user avatar
  • 345
0 votes
1 answer
32 views

NA values when using avg_predictions() from marginaleffects with a flexsurv model

I'm unsure why I do not get standard errors or confidence intervals when I fit parametric survival models and compute the predicted mean survival times using the avg_predictions(). I tried using ...
Tony's user avatar
  • 15
0 votes
0 answers
17 views

Negative average marginal effect for positive estimate in ordinal logistic regression [migrated]

I'm running an ordinal logistic regression with eight indepdent variables and the dependent variable has five categories (1 = Not at all and 5 = To a great extent). To interpret the coefficient ...
silje's user avatar
  • 25
0 votes
0 answers
29 views

How to calculate confidence interval using the delta method in R? [migrated]

I'm trying (struggling) to calculate the delta method for a confidence method in R. Does anyone know how to do it? Any advice would be most welcome. In the literature, there's a simple IV/2SLS model ...
Sam's user avatar
  • 13
0 votes
0 answers
24 views

Calculating Marginal Effects for 'endorse' models?

I am attempting to find the marginal effects for each covariate in the model: endorseFULL <- endorse(Y = Y, data = data_slvk, identical.lambda = FALSE, covariates = TRUE, formula.indiv = formula( ~ ...
user25699393's user avatar
0 votes
1 answer
40 views

Delta method confidence interval from 2SLS regression (with FE) using fixest and marginaleffects packages - Get NAs

I'm trying to find the confidence interval with the delta method using avg_comparisons() with the fixest feols() function for a 2SLS/IV + FE regression. My specification has only one independent ...
Sam's user avatar
  • 13
1 vote
0 answers
34 views

Joint hypothesis test with marginaleffects::hypotheses from a nnet::multinom object

I have a multinomial logistic regression model, fitted with nnet::multinom(). My outcome has three categories and I have used one predictor in the model. Ultimately I want to jointly test the null ...
ASt's user avatar
  • 11
0 votes
1 answer
37 views

Marginal effects contrasts in R: replicating rms::contrast and simultaneous confidence intervals

Im trying to replicate the rms::contrast function using the marginaleffects package in R, but am having difficulties. Particularly, I would like to request simultaneous confidence intervals for ...
user167591's user avatar
0 votes
0 answers
24 views

Setting user-specified values in plot_comparisions from marginal effects in R

I am using the marginaleffects package in R to analyze some results from a conjoint experiment. I've created a model object that is in the form of model = svyglm(dv ~ attribute1*...
Joe Loffredo's user avatar
0 votes
1 answer
60 views

`marginaleffects` error: Matrix columns are not supported

Summary I am trying to using marginaleffects::plot_predictions() to plot predictions from a GLMM. A minimal working example is provided below. The aim I'm trying to plot the predictions only for the ...
user9974638's user avatar
0 votes
1 answer
52 views

{marginaleffects} Average plot with plot_predictions() for alle clusters of a multi level model

I want to display a plot that shows the predictions of a lme4 model over all clusters, but I just get a plot for the mode cluster I have the following model and I want to know how "satislife"...
Nickii's user avatar
  • 1
1 vote
1 answer
58 views

Issues with Interaction Terms in slopes() Function from marginaleffects

I am using the marginaleffects package in R to calculate marginal effects from a multinomial logistic regression model (MNL) that includes an interaction term. I want to calculate the Marginal Effects ...
jj_allen's user avatar
1 vote
1 answer
81 views

How to replicate Stata 'margins at' command to interpret interaction effects using marginaleffects package in R?

I am trying to replicate some Stata code that uses average marginal effects to interpret interaction effects in R. Suppose I am using the mtcars dataset to estimate the average miles/gallon mpg of a ...
Flap's user avatar
  • 199
0 votes
1 answer
34 views

Diagnostic of marginal effects from a brms model

I'm using marginaleffects to compute the marginal treatment effects from a Bayesian logit model fit using brms: fit <- brm(y ~ (treat|state) + treat + age + sex + race, family = "bernoulli&...
Jonathan Gellar's user avatar

15 30 50 per page