Skip to main content
Filter by
Sorted by
Tagged with
0 votes
2 answers
57 views

I'm trying to use the marginaleffects library in R to get the estimates of a bunch of interaction effects from a bunch of different models. When I pass it an interaction that has a continuous ...
slammaster's user avatar
1 vote
1 answer
64 views

I am sure this is either due to my density/some semantic thing I'm not getting, but I'm having trouble getting marginaleffects to produce what I expect when using its comparisons command. What I am ...
pbaylis's user avatar
  • 1,656
-1 votes
1 answer
53 views

I'm struggling replicating the results given by avg_comparisons. What am I doing wrong? library(marginaleffects) dat <- get_dataset("thornton") mod <- glm(outcome ~ incentive * (...
robertspierre's user avatar
0 votes
1 answer
69 views

I cannot replicate marginaleffects::avg_predictions by hand when using the by argument. In the following example, the coefficient returned by marginaleffects for the nodegree==0 condition equals 8290. ...
robertspierre's user avatar
2 votes
1 answer
20 views

Trying to obtain marginal effects by group, simiar to Stata margins i.group, atmeans Below is my code: glm.model <- glm(y ~ factor(x1) + factor(x2) + x3 + x4, data = data, family = poisson(link = &...
user27842288's user avatar
1 vote
2 answers
107 views

I am trying to replicate the R emmeans package's weight="prop" in SAS. However, only reasonable method I could find was to explicitly state the average of one variable and the proportion of ...
aiorr's user avatar
  • 609
1 vote
1 answer
130 views

Let's say that I have the following linear model of the mpg as a function of gear (3, 4, and 5) and vs (0 or 1): mod <- lm(mpg ~ factor(gear) * factor(vs), data = mtcars) I know that I can obtain ...
A. Bohyn's user avatar
  • 197
1 vote
1 answer
139 views

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
  • 35
0 votes
1 answer
151 views

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
1 vote
1 answer
146 views

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
2 votes
1 answer
49 views

I'd like to use the inferences function to do some bootstrapping for a quantity which requires me to use comparison and transform arguments in avg_comparisons. However, when I pass the output of ...
Demetri Pananos's user avatar
0 votes
0 answers
140 views

Suppose I'm interested in estimating the effect of a binary variable for survival data as a hazard ratio. Before doing so, I want to split the observation period into two periods and estimate the ...
Stefan Hansen's user avatar
0 votes
2 answers
413 views

I would like to plot the marginal effect of a standard deviation increase and a standard deviation decrease of a model on the same plot. I am using the marginaleffects package, but I am open to other ...
Victor Shin's user avatar
0 votes
1 answer
795 views

I'm working with panel data using the plm package in R to estimate a fixed effects model that includes interaction terms. I'm currently able to get my model results using plm and display them with ...
User's user avatar
  • 25
0 votes
1 answer
410 views

I want to obtain pooled average predictions per level of a categorical variable using a multinomial regression on multiple imputed data. My problem is that the pool() function seems to collapse all ...
usual_user16960220's user avatar
1 vote
1 answer
409 views

I have a mixed effects logistic regression model: quietly melogit y i.x1 i.x2 || x3: Variable x1 is coded 0/1. I create the predicted probabilities for both values of x1: margins x1 Then I obtain ...
Ray's user avatar
  • 101
1 vote
1 answer
324 views

This question just migrated from crossvalidated, as it is indeed more a programming question. I have tried a lot of things (all kind of way to provide info to the newdata-argument), from which I ...
Dries's user avatar
  • 534
2 votes
0 answers
70 views

I want to get marginal estimate and its confidence interval for a binomial model with two random intercepts, but I don't know how to specify the random argument of "mixed_model" function of &...
Farzin Shamloo's user avatar
0 votes
1 answer
270 views

library(survey) # Analysis of Complex Survey Samples library(srvyr) # 'dplyr' inspired syntactic style # complex survey design design <- data %>% as_survey_design(ids = HOSP_NRD, weights = ...
Alex's user avatar
  • 73
0 votes
1 answer
407 views

I am attempting to use the marginaleffects package in R to plot the effect of treatment on the outcome across time (i.e., dynamic treatment effects). My data consists of two groups (treated and ...
CaptainAardvark's user avatar
0 votes
1 answer
232 views

I am fitting a mixed model in R with an interaction term as follows: model <- lmer(y ~ x * z + (1|h), data = df). y and x are continuous variables and z is a categorical variable, and h is a random ...
JaGo's user avatar
  • 17
3 votes
1 answer
233 views

I am working with a hierarchical model (lmerMod) that has an outcome and two categorical variables, cat1 and cat2. I want to make an interaction plot using ggplot2:: that visualizes the model ...
CompSocialSciR's user avatar
0 votes
1 answer
210 views

I generated three different marginal effect results using "probitmfx", but I am having a hard time generating one table with all the results in using Stargazer. Is there a simple way to get ...
Es003's user avatar
  • 21
2 votes
3 answers
618 views

Inspired by this youtube https://www.youtube.com/watch?v=7maMbX_65b0 by the ever fantastic Chuck Huber, how can I recreate the marginsplot of Stata in R? In other words, for my cplot() line at the end ...
Sandro's user avatar
  • 123
0 votes
0 answers
120 views

I have a logistic model which is created with statsmodel library. I want to get marginal effects, after that i will plot it. However, output of get_margeff() gives me table with all NA. Xtrain = df_3[...
Erdem's user avatar
  • 1