ggplot_fic: Plot focused model comparison statistics: ggplot2 method

View source: R/plot.fic.R

ggplot_ficR Documentation

Plot focused model comparison statistics: ggplot2 method

Description

This only works if the focus estimates are available. The focus estimates are plotted against the root MSE. One plot is made for each covariate value defining different focuses. If the wide model estimate is available, this is illustrated as a solid line on the plot, and if the narrow model estimate is available, this is showm as a dashed line.

Usage

ggplot_fic(
  x,
  ci = TRUE,
  adj = TRUE,
  legend = TRUE,
  ylab = NULL,
  xlab = NULL,
  xlim = NULL,
  ylim = NULL
)

Arguments

x

Output from fic.

ci

Plot interval estimates? (TRUE or FALSE). These are calculated as plus / minus twice the standard error of the submodel focus under the wide model. These are rough estimates of uncertainty intended to illustrate the bias-variance tradeoff, and exclude any uncertainty associated with the choice between models.

adj

The optimal model is the one with the lowest root mean square error (RMSE). If adj=TRUE the RMSE is based on the adjusted bias estimator. Otherwise the standard estimator is used.

legend

Show a legend, identifying

a) the line types for the wide and narrow models

b) the names of the terms of the wide model. This is used when the inds object supplied to fic was constructed by all_inds, so has row names made out of a string of 0s and 1s that identify the terms included in the submodel. These strings are plotted as text labels against the estimate for each submodel. The legend identifies which 0s and 1s correspond to which model terms.

ylab

y-axis label.

xlab

x-axis label.

xlim

x-axis limits (pair of numbers)

ylim

y-axis limits

See Also

plot.fic, summary.fic

Examples


## Example from the main vignette, see there for more details

wide.glm <- glm(low ~ lwtkg + age + smoke + ht + ui + smokeage + smokeui,
                data=birthwt, family=binomial)
vals.smoke <-    c(1, 58.24, 22.95, 1, 0, 0, 22.95, 0)
vals.nonsmoke <- c(1, 59.50, 23.43, 0, 0, 0, 0, 0)
X <- rbind("Smokers" = vals.smoke, "Non-smokers" = vals.nonsmoke)
inds0 <- c(1,1,0,0,0,0,0,0)
combs <- all_inds(wide.glm, inds0)
ficres <- fic(wide = wide.glm, inds = combs, inds0 = inds0,
              focus = prob_logistic, X = X)
ggplot_fic(ficres)
summary(ficres)


chjackson/fic documentation built on Aug. 30, 2023, 6:48 p.m.