Questions tagged [marginal-effects]

Marginal effects in regression analysis show how an explained variable changes when a particular explanatory variable changes ceteris paribus.

147 questions
1
vote
1 answer

Marginal effects/predictions at representative values (with other values at observed)

I have been looking around for a way to calculate marginal effects/predictions at specific values in R, while the remaining variables are kept as observed. I believe this is the default in Stata (for example, when using margins, at(age=(30 35 40 45…
edvinsyk
  • 160
  • 6
1
vote
1 answer

Getting marginal effects from a logistic regression with interactions using margins

I'm running three logistic models with all categorical variables, some of them binary but most of them with 3 or more factors as values, the first would be the base model, the second have 2 interaction terms and the third have a three-way…
1
vote
1 answer

Plot_cap response curve for counterfactual data

The following code was made up to replicate my problem with a bigger, more complex data set. library(marginaleffects) library(truncnorm) yield_kgha<-rtruncnorm(n=100, mean=2000, sd=150) n_kgha<-rtruncnorm(n=100, a=40, b=298, mean=150,…
Erin
  • 37
  • 4
1
vote
1 answer

ggeffects::ggpredict() doesn't return population level prediction intervals for nlme::lme()

I'm trying to get population level prediction intervals (PI) from ggeffects:ggpredict() using type = "re" from an nlme:lme() model. ggpredict is not returning the expected data for the lme() model, while the equivalent lmer() model works fine. My…
Jem Arnold
  • 13
  • 1
  • 4
1
vote
0 answers

Is there a way to subset data for Python statsmodels .get_margeff() like in R margins()?

I created a model using mnlogit() from statsmodels that looks something similar to this: formula = "Switch_Variable ~ Prior_Complication_categ * C(Prior_Delivery_Type) + C(RaceName) + C(EthnicityName) + AgeInYears + C(Insurance) + TotalScore +…
1
vote
1 answer

Marginal effects for coefficients of a beta regression

I am fitting a beta regression using the betareg function in R. I would like to use a function like effect or margins to compute the marginal effects of the coefficients. However none of both of them actually work with this kind of model. Does…
Bibi
  • 87
  • 9
1
vote
1 answer

Calculate marginal effects for ordinal::clmm

I have some problems with calculating the AME (…average marginal effects…) from an ordinal model (ordinal::clmm()) with random effects (in my case a four level year factor). The functions margins::margins() and mfx::probitmfx() don't work. The…
Eco007
  • 11
  • 2
1
vote
2 answers

interaction effects of marginal effects and its standard errors in glm with R

I viewed lots of relevant bloggers who explained how to generate marginal effects, but somehow most of them did not take interaction effects as sample. When I use Stata to do it, the margin effects are quite easy to compute, but R seems in another…
vlamenco
  • 37
  • 6
1
vote
1 answer

How to calculate marginal effects of logit model with fixed effects by using a sample of more than 50 million observations

I have a sample of more than 50 million observations. I estimate the following model in R: model1 <- feglm(rejection~ variable1+ variable1^2 + variable2+ variable3+ variable4 | city_fixed_effects + year_fixed_effects,…
1
vote
0 answers

Marginal effects for bivariate probit regression with GJRM

Im looking for marginal effects in my bivariate probit model in R. For the univariate case via model <- glm(formula, family=binomal(link="probit")) its clear how to get them: simply take margins(model) But now I have a model estimated with the gjrm…
r_10_b
  • 11
  • 1
1
vote
2 answers

How to compute marginal effects of a multinomial logit model created with the nnet package?

I have a multinomial logit model created with the nnet R package, using the multinom command. The dependent variable has three categories/choice options. I am modelling the probability of selecting a certain irrigation type (no irrigation, surface…
Charlotte
  • 15
  • 6
1
vote
1 answer

Marginal effects from the multinomial model

I am trying to get the marginal effects from a multinomial model derived from the mlogit package but it shows an error. Can anyone provide some guidance to solve the problem? Many thanks! # data df1 <- structure(list(Y = c(3, 4, 1, 2, 3, 4, 1, 5, 2,…
cliu
  • 933
  • 6
  • 13
1
vote
1 answer

Calculate marginal effect of dummy (and its standard error) for Tobit in R

I have a standard Tobit model where the only explanatory variable is a dummy for treatment (plus the intercept), and I want to estimate the marginal effect of this treatment on my dependent variable and also the standard error of this ME. I know…
M. L.
  • 11
  • 3
1
vote
1 answer

using "at" specification in Margins (problem with factors)

Does anybody know if (or when?) we can use the “at” specification for factor variables in the Margins Package? According to the Margins vignette (dated 2018-05-22), this is not always possible "yet". I quote from the vignette below: “A really nice…
1
vote
0 answers

statistical test to compare 1st/2nd differences based on output from ggpredict / ggeffect

I want to conduct a simple two sample t-test in R to compare marginal effects that are generated by ggpredict (or ggeffect). Both ggpredict and ggeffect provide nice outputs: (1) table (pred prob / std error / CIs) and (2) plot. However, it does…