-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support drawing of cplot() effects for factors with more than two levels #46
Comments
Hi, |
@methodds Not currently. What package do you use to for multinomial or ordered response variables? Is it with |
I'm not sure whether you perhaps misunderstood what I'm looking for. The different lines in the plot above refer to categories of an explanatory variable. The dependent variable still reflects probabilities from a logit model. |
@methodds Ah, sorry. I thought the graph was predicted probabilities for a multiple outcome regression (ordered/multinomial logit) model. If you just want to show predictions, that's currently possible. It just requires running library("datasets")
library("stats")
library("margins")
iris$long <- rbinom(nrow(iris), 1, 0.6)
x <- glm(long ~ Sepal.Width*Species, data = iris)
cplot(x, x = "Sepal.Width", data = iris[iris$Species == "setosa", ], ylim = c(0,1), col = "red", se.fill = NA, xlim = c(0,5))
cplot(x, x = "Sepal.Width", data = iris[iris$Species == "versicolor", ], draw = "add", col = "blue", se.fill = NA)
cplot(x, x = "Sepal.Width", data = iris[iris$Species == "virginica", ], draw = "add", col = "green", se.fill = NA) It's not ideal, but should get you to what you need. |
just what I needed! thanks for the example :) |
I've added this example to the documentation. I'm going to close this for now; may revisit later. |
Currently, an error is issued when trying to display the conditional effect(s) of a factor variable that has more than two levels in
cplot()
:This could be fixed to display effect of each level/transition for the factor.
margins()
already does this fine, but it's a matter of figuring out how to draw it and return the data it appropriately.The text was updated successfully, but these errors were encountered: