densityPlot: Lattice plot of conditional densities

View source: R/densityPlot.R

densityPlotR Documentation

Lattice plot of conditional densities

Description

This function produces conditional density plots at input covariate values.

Usage

densityPlot(
  X,
  minY = NULL,
  maxY = NULL,
  nGrid = 100,
  yGrid = NULL,
  model = NULL,
  trueDensity = NULL,
  plot = TRUE,
  layout = NULL,
  factor.levels = NULL,
  strip.font.size = NULL,
  main = NULL
)

Arguments

X

the covariate matrix to predict conditional densities at; each row represents an observation vector.

minY

the minimal possible response value. If yGrid is NULL, then the response grid will be generated by dividing (minY, maxY) into nGrid equal bins and using the mid-points as yGrid. Default is NULL.

maxY

the maximal possible response value. For more, see minY. Default is NULL.

nGrid

the number of response grid points. For more, see minY. Default is 100.

yGrid

the response grid to evaluate conditional densities at. Default is NULL.

model

a conditional density model with a predict method, e.g., a LinCDE boosting model. The call predict(model, X, y) should return a vector of estimated conditional densities f(yi | Xi). Default is NULL. To only plot the true conditional densities, use the default value.

trueDensity

true conditional density function. The call trueDensity(X, y) should return a vector of true conditional densities f(yi | Xi). Default is NULL. To only plot LinCDE's estimated conditional densities, use the default value.

plot

if TRUE, the density plots are printed. If FALSE, the data frame of true/estimated densities to generate the density plots are returned.

layout

a numeric vector of length 2 giving the number of columns, rows in the multipanel display. In general, a conditioning plot in lattice consists of several panels arranged in a rectangular array and layout determines this arrangement. Default is to arrange panels in an approximately square array.

factor.levels

vector of character strings or expressions giving the levels of the conditioning variable. The factor.levels will be written on the panel strips. Default is R (for "region") followed by the index of the region, e.g., R1.

strip.font.size

a numeric value indicating the font size on strips in the multipanel density plots. Default is 0.8.

main

a main title for the plot.

Value

The function outputs a lattice plot of conditional densities.


ZijunGao/LinCDE documentation built on Jan. 2, 2023, 11:14 p.m.