Average marginal effects (AMEs) in partial proportional odds model
up vote
2
down vote
favorite
How do I get average marginal effects (AMEs) for each category/threshold in a partial proportional odds model (PPOM)?
This is my first post in this forum. I hope that I have heeded the most essential recommendations for asking good questions.
This sample dataset consists of an ordinal outcome variable (Y1) and three independent variables (VAR1, VAR2, VAR3).
set.seed(3)
sampleData <- data.frame(id = 1:1000, Y1 = sample(c("1", "2", "3", "4"),
1000, replace=TRUE), Var1 = rnorm(1000, 40, 10),
Var2 = rnorm(1000, 60, 10), Var3 = rnorm(1000, 80, 5))
Assuming proportional odds assumption is violated, one could carry out a partial proportional odds model (PPOM) using package ordinal to predict Y1 by the three independent variables (Var1, Var2, Var3).
library(ordinal)
PPOM <- clm(as.factor(Y1) ~ Var1 + Var2 + Var3,
nominal = ~ Var1 + Var2 + Var3, data = sampleData)
We get the following output with coefficients for each category:
summary(PPOM)
formula: as.factor(Y1) ~ Var1 + Var2 + Var3
nominal: ~Var1 + Var2 + Var3
data: sampleData
link threshold nobs logLik AIC niter max.grad cond.H
logit flexible 1000 -1381.17 2786.34 4(0) 2.82e-10 2.2e+07
Coefficients: (3 not defined because of singularities)
Estimate Std. Error z value Pr(>|z|)
Var1 NA NA NA NA
Var2 NA NA NA NA
Var3 NA NA NA NA
Threshold coefficients:
Estimate Std. Error z value
1|2.(Intercept) 0.4952642 1.2260010 0.404
2|3.(Intercept) 1.9790234 1.0724982 1.845
3|4.(Intercept) 2.0892425 1.2550636 1.665
1|2.Var1 0.0026194 0.0075920 0.345
2|3.Var1 -0.0077578 0.0065845 -1.178
3|4.Var1 -0.0064243 0.0075364 -0.852
1|2.Var2 -0.0001089 0.0074568 -0.015
2|3.Var2 -0.0082836 0.0063447 -1.306
3|4.Var2 -0.0073638 0.0071008 -1.037
1|2.Var3 -0.0219767 0.0140701 -1.562
2|3.Var3 -0.0157235 0.0121943 -1.289
3|4.Var3 -0.0047098 0.0141844 -0.332
I am interested in AMEs for each predictor for each category. By using margins I get only AMEs for all of the thresholds together.
library(margins)
summary(margins(PPOM))
Output:
factor AME SE z p lower upper
Var1 0.0000 0.0000 1.1365 0.2557 -0.0000 0.0001
Var2 0.0000 0.0000 1.3056 0.1917 -0.0000 0.0001
Var3 0.0001 0.0001 0.9990 0.3178 -0.0001 0.0002
Does anyone know hot to calculate AMEs for each category?
Any help would be greatly appreciated!
r
add a comment |
up vote
2
down vote
favorite
How do I get average marginal effects (AMEs) for each category/threshold in a partial proportional odds model (PPOM)?
This is my first post in this forum. I hope that I have heeded the most essential recommendations for asking good questions.
This sample dataset consists of an ordinal outcome variable (Y1) and three independent variables (VAR1, VAR2, VAR3).
set.seed(3)
sampleData <- data.frame(id = 1:1000, Y1 = sample(c("1", "2", "3", "4"),
1000, replace=TRUE), Var1 = rnorm(1000, 40, 10),
Var2 = rnorm(1000, 60, 10), Var3 = rnorm(1000, 80, 5))
Assuming proportional odds assumption is violated, one could carry out a partial proportional odds model (PPOM) using package ordinal to predict Y1 by the three independent variables (Var1, Var2, Var3).
library(ordinal)
PPOM <- clm(as.factor(Y1) ~ Var1 + Var2 + Var3,
nominal = ~ Var1 + Var2 + Var3, data = sampleData)
We get the following output with coefficients for each category:
summary(PPOM)
formula: as.factor(Y1) ~ Var1 + Var2 + Var3
nominal: ~Var1 + Var2 + Var3
data: sampleData
link threshold nobs logLik AIC niter max.grad cond.H
logit flexible 1000 -1381.17 2786.34 4(0) 2.82e-10 2.2e+07
Coefficients: (3 not defined because of singularities)
Estimate Std. Error z value Pr(>|z|)
Var1 NA NA NA NA
Var2 NA NA NA NA
Var3 NA NA NA NA
Threshold coefficients:
Estimate Std. Error z value
1|2.(Intercept) 0.4952642 1.2260010 0.404
2|3.(Intercept) 1.9790234 1.0724982 1.845
3|4.(Intercept) 2.0892425 1.2550636 1.665
1|2.Var1 0.0026194 0.0075920 0.345
2|3.Var1 -0.0077578 0.0065845 -1.178
3|4.Var1 -0.0064243 0.0075364 -0.852
1|2.Var2 -0.0001089 0.0074568 -0.015
2|3.Var2 -0.0082836 0.0063447 -1.306
3|4.Var2 -0.0073638 0.0071008 -1.037
1|2.Var3 -0.0219767 0.0140701 -1.562
2|3.Var3 -0.0157235 0.0121943 -1.289
3|4.Var3 -0.0047098 0.0141844 -0.332
I am interested in AMEs for each predictor for each category. By using margins I get only AMEs for all of the thresholds together.
library(margins)
summary(margins(PPOM))
Output:
factor AME SE z p lower upper
Var1 0.0000 0.0000 1.1365 0.2557 -0.0000 0.0001
Var2 0.0000 0.0000 1.3056 0.1917 -0.0000 0.0001
Var3 0.0001 0.0001 0.9990 0.3178 -0.0001 0.0002
Does anyone know hot to calculate AMEs for each category?
Any help would be greatly appreciated!
r
I think you can use theatargument for that? See cran.r-project.org/web/packages/margins/vignettes/…
– Daniel
Nov 23 at 16:25
add a comment |
up vote
2
down vote
favorite
up vote
2
down vote
favorite
How do I get average marginal effects (AMEs) for each category/threshold in a partial proportional odds model (PPOM)?
This is my first post in this forum. I hope that I have heeded the most essential recommendations for asking good questions.
This sample dataset consists of an ordinal outcome variable (Y1) and three independent variables (VAR1, VAR2, VAR3).
set.seed(3)
sampleData <- data.frame(id = 1:1000, Y1 = sample(c("1", "2", "3", "4"),
1000, replace=TRUE), Var1 = rnorm(1000, 40, 10),
Var2 = rnorm(1000, 60, 10), Var3 = rnorm(1000, 80, 5))
Assuming proportional odds assumption is violated, one could carry out a partial proportional odds model (PPOM) using package ordinal to predict Y1 by the three independent variables (Var1, Var2, Var3).
library(ordinal)
PPOM <- clm(as.factor(Y1) ~ Var1 + Var2 + Var3,
nominal = ~ Var1 + Var2 + Var3, data = sampleData)
We get the following output with coefficients for each category:
summary(PPOM)
formula: as.factor(Y1) ~ Var1 + Var2 + Var3
nominal: ~Var1 + Var2 + Var3
data: sampleData
link threshold nobs logLik AIC niter max.grad cond.H
logit flexible 1000 -1381.17 2786.34 4(0) 2.82e-10 2.2e+07
Coefficients: (3 not defined because of singularities)
Estimate Std. Error z value Pr(>|z|)
Var1 NA NA NA NA
Var2 NA NA NA NA
Var3 NA NA NA NA
Threshold coefficients:
Estimate Std. Error z value
1|2.(Intercept) 0.4952642 1.2260010 0.404
2|3.(Intercept) 1.9790234 1.0724982 1.845
3|4.(Intercept) 2.0892425 1.2550636 1.665
1|2.Var1 0.0026194 0.0075920 0.345
2|3.Var1 -0.0077578 0.0065845 -1.178
3|4.Var1 -0.0064243 0.0075364 -0.852
1|2.Var2 -0.0001089 0.0074568 -0.015
2|3.Var2 -0.0082836 0.0063447 -1.306
3|4.Var2 -0.0073638 0.0071008 -1.037
1|2.Var3 -0.0219767 0.0140701 -1.562
2|3.Var3 -0.0157235 0.0121943 -1.289
3|4.Var3 -0.0047098 0.0141844 -0.332
I am interested in AMEs for each predictor for each category. By using margins I get only AMEs for all of the thresholds together.
library(margins)
summary(margins(PPOM))
Output:
factor AME SE z p lower upper
Var1 0.0000 0.0000 1.1365 0.2557 -0.0000 0.0001
Var2 0.0000 0.0000 1.3056 0.1917 -0.0000 0.0001
Var3 0.0001 0.0001 0.9990 0.3178 -0.0001 0.0002
Does anyone know hot to calculate AMEs for each category?
Any help would be greatly appreciated!
r
How do I get average marginal effects (AMEs) for each category/threshold in a partial proportional odds model (PPOM)?
This is my first post in this forum. I hope that I have heeded the most essential recommendations for asking good questions.
This sample dataset consists of an ordinal outcome variable (Y1) and three independent variables (VAR1, VAR2, VAR3).
set.seed(3)
sampleData <- data.frame(id = 1:1000, Y1 = sample(c("1", "2", "3", "4"),
1000, replace=TRUE), Var1 = rnorm(1000, 40, 10),
Var2 = rnorm(1000, 60, 10), Var3 = rnorm(1000, 80, 5))
Assuming proportional odds assumption is violated, one could carry out a partial proportional odds model (PPOM) using package ordinal to predict Y1 by the three independent variables (Var1, Var2, Var3).
library(ordinal)
PPOM <- clm(as.factor(Y1) ~ Var1 + Var2 + Var3,
nominal = ~ Var1 + Var2 + Var3, data = sampleData)
We get the following output with coefficients for each category:
summary(PPOM)
formula: as.factor(Y1) ~ Var1 + Var2 + Var3
nominal: ~Var1 + Var2 + Var3
data: sampleData
link threshold nobs logLik AIC niter max.grad cond.H
logit flexible 1000 -1381.17 2786.34 4(0) 2.82e-10 2.2e+07
Coefficients: (3 not defined because of singularities)
Estimate Std. Error z value Pr(>|z|)
Var1 NA NA NA NA
Var2 NA NA NA NA
Var3 NA NA NA NA
Threshold coefficients:
Estimate Std. Error z value
1|2.(Intercept) 0.4952642 1.2260010 0.404
2|3.(Intercept) 1.9790234 1.0724982 1.845
3|4.(Intercept) 2.0892425 1.2550636 1.665
1|2.Var1 0.0026194 0.0075920 0.345
2|3.Var1 -0.0077578 0.0065845 -1.178
3|4.Var1 -0.0064243 0.0075364 -0.852
1|2.Var2 -0.0001089 0.0074568 -0.015
2|3.Var2 -0.0082836 0.0063447 -1.306
3|4.Var2 -0.0073638 0.0071008 -1.037
1|2.Var3 -0.0219767 0.0140701 -1.562
2|3.Var3 -0.0157235 0.0121943 -1.289
3|4.Var3 -0.0047098 0.0141844 -0.332
I am interested in AMEs for each predictor for each category. By using margins I get only AMEs for all of the thresholds together.
library(margins)
summary(margins(PPOM))
Output:
factor AME SE z p lower upper
Var1 0.0000 0.0000 1.1365 0.2557 -0.0000 0.0001
Var2 0.0000 0.0000 1.3056 0.1917 -0.0000 0.0001
Var3 0.0001 0.0001 0.9990 0.3178 -0.0001 0.0002
Does anyone know hot to calculate AMEs for each category?
Any help would be greatly appreciated!
r
r
asked Nov 13 at 15:36
Ralf Schneider
111
111
I think you can use theatargument for that? See cran.r-project.org/web/packages/margins/vignettes/…
– Daniel
Nov 23 at 16:25
add a comment |
I think you can use theatargument for that? See cran.r-project.org/web/packages/margins/vignettes/…
– Daniel
Nov 23 at 16:25
I think you can use the
at argument for that? See cran.r-project.org/web/packages/margins/vignettes/…– Daniel
Nov 23 at 16:25
I think you can use the
at argument for that? See cran.r-project.org/web/packages/margins/vignettes/…– Daniel
Nov 23 at 16:25
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53284437%2faverage-marginal-effects-ames-in-partial-proportional-odds-model%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I think you can use the
atargument for that? See cran.r-project.org/web/packages/margins/vignettes/…– Daniel
Nov 23 at 16:25