Learn R Programming

psre (version 0.1.2)

gg_hmf: Heatmap Fit Plot using GGplot

Description

Makes a Heatmap Fit plot (Esary and Pierce, 2012) using GGPlot rather than lattice that the heatmapFit package uses.

Usage

gg_hmf(
  observed,
  prob,
  method = c("loess", "gam"),
  span = NULL,
  nbin = 20,
  R = 1000,
  ...
)

Value

Two ggplots - the main heatmap Fit plot and a histogram that can be included as a marginal density.

Arguments

observed

Vector of observe (0/1) values used in a binary regression model.

prob

Vector of predicted probabilities from the model with observed as the dependent variable.

method

Method for making the line - LOESS or GAM (from the mgcv package.)

span

Optional span parameter to be passed in. If NULL, AICc will be used to find the appropriate span for the loess smooth.

nbin

Number of bins for the histogram.

R

Number of boostrap resamples

...

Currently unimplemented.

Examples

Run this code
# \donttest{
data(india)
india$bjp <- ifelse(india$in_prty == 2, 1, 0)
mod1 <- glm(bjp ~  educyrs + anti_immigration, 
            data=india, family=binomial)

gh1 <- gg_hmf(model.response(model.frame(mod1)), 
              fitted(mod1), 
              method="loess")
# }

Run the code above in your browser using DataLab