Description Usage Arguments Value Author(s) References See Also Examples
Plots observed proportions against mean predicted probabilities from a logistic regression model. For a good fit, points should be approximately on a straight line.
1 2 3 4 5 |
x |
one of two possibilities: 1) a model object of class |
newdata |
a dataframe containing a vector of observations for which to evaluate predictions. |
method |
Either "cut", in which case the vector of cut-off points supplied by the "where" argument will be used to partition the fitted probabilities, or "shingle", in which a shingle (using equal.count and its defaults) will be used. |
where |
A vector of cut-off points for partitioning the vector of fitted probabilities, by default |
scalesize |
A positive real <= 1. If not NA (the default), the circles representing data points in the graph are scaled to reflect the number of data points in the underlying data set. The scalesize parameter specifies how large the largest circle will be compared to 1 inch. For counts with large outliers, small values of scalesize are better. See example below. |
r2 |
logical. Should the R-squared correlation between predictions and observations be added to the printout? |
dot.shape |
numeric. Shape of the plotted points (default is solid circles). |
dot.size |
numeric. Size of plotted points. |
col |
character. Color of plotted points. |
add.se |
logical. Should error bars for the standard errors of the mean probabilities be plotted? |
A ggplot2
object to which other layers can be added. Note the optional R-squared value above the plot represents the correlation between the X and Y values in the plot. It does NOT represent the R-squared of the model itself.
Jason Grafmiller
Baayen, R.H. (2008). Analyzing Linguistic Data. Cambridge: Cambridge University Press.
This borrows heavily from plotlogistic.fit.fnc
in the languageR
package. For more plotting options, see geom_point
and geom_abline
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ## Not run:
data(brown_genitives)
require(lme4)
require(rms)
require(lmerTest)
require(ggplot2)
genitive.lrm = lrm(Type ~ PossrAnimacyBin +
PossrWordC + Genre, data = brown_genitives)
genitive.glm = glm(Type ~ PossrAnimacyBin +
PossrWordC + Genre, data = brown_genitives, family = binomial)
genitive.glmm = glmer(Type ~ PossrAnimacyBin +
PossrWordC + Genre + (1|Text), data = brown_genitives,
family = binomial, control = glmerControl(optimizer = "bobyqa"))
ggLogit.plot(genitive.lrm, brown_genitives)
ggLogit.plot(genitive.glm, brown_genitives, col = "red") + theme_bw()
ggLogit.plot(genitive.glmm, brown_genitives, dot.shape = 2, r2 = T)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.