nm.covplot: Create covariate plot and data

View source: R/nm.covplot.r

nm.covplotR Documentation

Create covariate plot and data

Description

Create ETA vs covariates and parameter estimates vs covariates. Programmed with the intention to get between 95-100% of report Appendices ready plots. If not, the data.frames on basis of which they were created are available as well to enable creating the desired graphs very easily.

Usage

nm.covplot(
  run = "run1",
  path = getOption("nmDir"),
  id.var = "ID",
  iov = FALSE,
  eta.densities = TRUE,
  eta.skip = NULL,
  shrinkage = FALSE,
  covlist = list(cat = c(NULL), con = c(NULL)),
  catcov.sep = 5,
  parameters = NULL,
  aspect = "fill",
  pcx = 0.5,
  uniques = FALSE,
  which.list = 1
)

Arguments

run

run rootname (e.g. run1)

path

directory where run resides

id.var

character string denoting grouping variable ("ID")

iov

inter-occasion variability flag (this argument is ignored currently)

eta.densities

logical to determine of ETA density plots have to be generated

eta.skip

character vector of ETAs that will be skipped

shrinkage

providing shrinkage values. This is currently ignored

covlist

a list with elements cat and con each representing a character vector with categorical and continuous covariates, respectively.

catcov.sep

max number of unique values for a covariate to be assigned 'categorical'

parameters

a character vector with parameter names to plot

aspect

lattice banking aspect for rectangular or square plots. Defaults to 'fill'

pcx

dot size

uniques

set to TRUE to look at one value per ID only. defaults to F

which.list

which element of the list in case multiple regression methods were used. Defaults to 1.

Value

A list with plots and properly sorted / molten data.frames for customized plots

Examples

args(nm.covplot)
nmcov = nm.covplot(path = getOption("qpExampleDir")
, run = "example2", parameters = c("CL","V1","Q","V2")
, covlist = list(con = "AGE", cat = "GNDR"))

#contents of the list
names(nmcov)
#[1] "covdata"        "eta.splom"      "eta.dens"
# "conData.eta"    "catData.eta"    "conData.par"    "catData.par"
#[8] "etaContVarPlot" "etaCatVarPlot"  "parContVarPlot" "parCatVarPlot"

# let's look at the plots
nmcov$eta.dens()
# red line is the distribution predicted obo OMEGA estimate
# the grey polygon is the actual ETA distribution

## elegant pairs plot
nmcov$eta.splom()

## ETAs vs. Continuous Covariates
nmcov$etaContVarPlot()

## ETAs vs. Categorical Covariates
nmcov$etaCatVarPlot()
nmcov$etaCatVarPlot(F)

## parameters vs. Continuous Covariates
nmcov$parContVarPlot()

## parameters vs. Categorical Covariates
nmcov$parCatVarPlot()

## data frames required to replot the above are right there for convenience
head(nmcov$covdata) ## merged get.xpose.table and nm.params.table output!
head(nmcov$conData.eta)# essential: conVariable conValue variable value
head(nmcov$catData.eta)# essential: catVariable catValue variable value
head(nmcov$conData.par)# essential: conVariable conValue variable value
head(nmcov$catData.par)# essential: catVariable catValue variable value

#for continuous plots get kickstarted with:
# xyplot(value ~ conValue | casefold(variable, upper = TRUE) * conVariable
#  , data = conData, panel = panel.xyplot)
#for categorical plots:
# xyplot(value ~ as.factor(paste(catValue)) | variable * catVariable
#  , data = catData, panel = panel.bwplot, horizontal = FALSE)


qPharmetra/qpToolkit documentation built on May 24, 2023, 8:52 a.m.