Description Usage Arguments Details Value Examples

View source: R/emplogitplot1.r

This function produces an empirical logit plot for a binary response variable and a single quantitative predictor variable.

1 2 3 4 5 |

`formula` |
A formula of the form (binary) Response~Predictor |

`data` |
A dataframe |

`ngroups` |
Number of groups to use (not needed if breaks is used), ngroups="all" uses all unique values |

`breaks` |
A vector of endpoints for the bins (not needed if ngroups is used) |

`yes` |
Set a value for the response to be counted for proportions (optional) |

`padj` |
Should proportions be adjusted to avoid zero and one? (default is TRUE) |

`out` |
Should the function return a dataframe with group information? (default is FALSE) |

`showplot` |
Show the plot? default is TRUE |

`showline` |
Show the regression line? default is TRUE |

`ylab` |
Text label for the vertical axis (default is "Log(Odds)") |

`xlab` |
Text label for the horizontal axis (default is NULL) |

`dotcol` |
Color for the dots (default is "black") |

`linecol` |
Color for the line (default is "black") |

`pch` |
Plot character for the dots (default is 16) |

`main` |
Title for plot |

`ylim` |
Limits for the vertical axis |

`xlim` |
Limits for the horizontal axis |

`lty` |
Line type (default is 1) |

`lwd` |
Line width (default is 1) |

`cex` |
Multiplier for plot symbols |

Values of the quantitative explanatory variable will be grouped into `ngroups`

roughly equal sized groups, unless `breaks`

is used to determine the boundaries of the groups.
Using `ngroups="all"`

will make each distinct value of the explanatory variable its own group

We find an adjusted proportion for the binary response variable within each of the groups with
`(Number yes +0.5)/(Number of cases+1)`

. This is converted to an adjusted log odds
`log(adjp/(1-adjp))`

. The adjustment avoids problems if there are no "successes" or
all "successes" in a group. What constitutes a "success" can be specified with `yes=`

and the proportion adjustment can be turned off (if no group proportions are likely to be zero or one)
with `padj=FALSE`

.

The function plots the log odds versus the mean of the explanatory variable within each group.
A least square line is fit to these points. The plot can be suppressed with `showplot=FALSE`

.

The `out=TRUE`

option will return a dataframe with the boundaries of each group, proportion,
adjusted proportion, mean explanatory variable, and (adjusted or unadjusted) log odds.

A dataframe with group information (if out=TRUE)

1 2 3 4 5 6 7 8 9 | ```
data(MedGPA)
emplogitplot1(Acceptance~GPA,data=MedGPA)
GroupTable=emplogitplot1(Acceptance~MCAT,ngroups=5,out=TRUE,data=MedGPA)
emplogitplot1(Acceptance~MCAT,data=MedGPA,breaks=c(0,34.5,39.5,50.5),dotcol="red",linecol="black")
data(Putts1)
emplogitplot1(Made~Length,data=Putts1,ngroups="all")
``` |

statmanrobin/Stat2Data documentation built on Jan. 6, 2019, 1:08 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.