Average marginal effects (AMEs) in partial proportional odds model










2















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!










share|improve this question






















  • I think you can use the at argument for that? See cran.r-project.org/web/packages/margins/vignettes/…

    – Daniel
    Nov 23 '18 at 16:25















2















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!










share|improve this question






















  • I think you can use the at argument for that? See cran.r-project.org/web/packages/margins/vignettes/…

    – Daniel
    Nov 23 '18 at 16:25













2












2








2








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!










share|improve this question














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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 13 '18 at 15:36









Ralf SchneiderRalf Schneider

111




111












  • I think you can use the at argument for that? See cran.r-project.org/web/packages/margins/vignettes/…

    – Daniel
    Nov 23 '18 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 '18 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 '18 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 '18 at 16:25












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















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

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Use pre created SQLite database for Android project in kotlin

Darth Vader #20

Ondo