plotlogistic.fit.fnc {languageR}R Documentation

Plot for goodness of fit of logistic regression

Description

This function plots observed proportions against mean predicted probabilities. For a good fit, points should be approximately on a straight line.

Usage

plotlogistic.fit.fnc(x, data, method, where, scalesize, ...)

Arguments

x

A logistic regression model fitted with lmer or lrm.

data

The data set to which the model was fitted.

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 seq(0, 1, by=0.1)

.

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.

...

other parameters to be passed through to plotting functions.

Value

A plot is produced on the graphics device. The R-squared value shown above the plot represents the correlation between the X and Y values in the plot. It does NOT represent the R-squared of the lrm or lmer model.

Author(s)

R. H. Baayen

Examples

## Not run: 
data(dative)
require(lme4)
require(rms)
require(lmerTest)
require(optimx)

dative.lrm = lrm(RealizationOfRecipient ~ AccessOfTheme + 
   AccessOfRec + LengthOfRecipient + AnimacyOfRec +
   AnimacyOfTheme + PronomOfTheme + DefinOfTheme + LengthOfTheme +
   SemanticClass + Modality, 
   data = dative)

dative.glmm = glmer(RealizationOfRecipient ~ AccessOfTheme + 
   AccessOfRec + LengthOfRecipient + AnimacyOfRec +
   AnimacyOfTheme + PronomOfTheme + DefinOfTheme + LengthOfTheme +
   SemanticClass + Modality + (1|Verb), 
   control=glmerControl(optimizer="optimx",optCtrl=list(method="nlminb")),
   data = dative, family = "binomial")

par(mfrow=c(2,2))
plotlogistic.fit.fnc (dative.lrm, dative)
mtext("lrm", 3, 3)
plotlogistic.fit.fnc (dative.glmm, dative)
mtext("lmer", 3, 3)
plotlogistic.fit.fnc (dative.lrm, dative, scalesize=0.2)
mtext("lrm", 3, 3)
plotlogistic.fit.fnc (dative.glmm, dative, method="shingle")
mtext("lmer", 3, 3)
par(mfrow=c(1,1))



## End(Not run)

[Package languageR version 1.5.0 Index]