varianceGraph.cgOneFactorFit {cg} | R Documentation |
Equal Variance Graphs assessment of cgOneFactorFit object
Description
Graph residuals of a cgOneFactorFit object to assess equal variance assumption
Usage
## S4 method for signature 'cgOneFactorFit'
varianceGraph(fit, trend = NULL, cgtheme = TRUE,
device = "single", ...)
Arguments
fit |
A fit object of class |
trend |
Add a trend line. When set to the default |
cgtheme |
When set to the default |
device |
Can be one of three values:
|
... |
Additional arguments. Two are currently valid:
|
Details
The graph plots the square root of the absolute value of the residuals against the fitted value. The square root spacing on the y-axis has tick marks in the fitted scale. The notion of using the squared root of the absolute residuals is attributed to John Tukey.
The values are automatically jittered to minimize overlapping points. For censored data, left-censored values are shown as a shallow "V", which is actually just a rotated downward "<" sign. Similarly, right-censored values are shown as a deeper "^", which is a rotated upward ">" sign.
For the trend
argument, an added trend line when censored data residuals
are present needs to be interpreted cautiously. When there are 7 or more
groups, a cubic smoothing spline based on VGAM::vgam
is fit; otherwise, the group means of the residuals are estimated with
an accelerated failure time model and then just connected. If "too many"
censored data values are present, the line may be withheld and
warnings will be issued, or if forced with line=TRUE
, for
example, may appear nonsensical.
The heading for the graph is taken from the cgOneFactorData
object,
which prepareCGOneFactorData
sets from its analysisname
argument.
The label for the Y-axis is taken from the cgOneFactorData
object,
which prepareCGOneFactorData
sets from its endptname
argument.
The number of decimal places printed in the ticks on the Y-axis is taken
from the cgOneFactorData
object,
which prepareCGOneFactorData
sets from its digits
argument.
The minimum and maximum values from the range of the absolute valued residuals are respectively labeled in the bottom and top left corners of the graph region.
If group labels along the x-axis seem to overlap in the standard horizontal form, they will be rotated 45 degrees.
Value
varianceGraph.cgOneFactorFit
returns
an invisible NULL
. The main purpose is the side
effect of graphing to the current device.
Note
Contact cg@billpikounis.net for bug reports, questions, concerns, and comments.
Author(s)
Bill Pikounis [aut, cre, cph], John Oleynick [aut], Eva Ye [ctb]
Examples
## From running examples of cgOneFactorData objects
data(canine)
canine.data <- prepareCGOneFactorData(canine, format="groupcolumns",
analysisname="Canine",
endptname="Prostate Volume",
endptunits=expression(plain(cm)^3),
digits=1, logscale=TRUE, refgrp="CC")
canine.fit <- fit(canine.data)
varianceGraph(canine.fit)
varianceGraph(canine.fit, model="olsonly")
gmcsfcens.data <- prepareCGOneFactorData(gmcsfcens, format="groupcolumns",
analysisname="cytokine",
endptname="GM-CSF (pg/ml)",
logscale=TRUE,
digits=1)
gmcsfcens.fit <- fit(gmcsfcens.data, type="aft")
varianceGraph(gmcsfcens.fit, trend=TRUE)
varianceGraph(gmcsfcens.fit) ## will yield a warning message why no line
## is graphed
varianceGraph(gmcsfcens.fit, trend=FALSE)