Learn R Programming

cg (version 1.0-3)

varianceTable.cgPairedDifferenceFit: Compute Variances from a cgPairedDifferenceFit object

Description

Create a table of variance component estimates of the data in a cgPairedDifferenceFit object.

Usage

"varianceTable"(fit, display = "print", ...)

Arguments

fit
A cgPairedDifferenceFit object, typically created by fit.cgPairedDifferenceData.
display
One of three valid values:
"print"
The default value; It calls a print method for the created cgPairedDifferenceVarianceTable object, which is a formatted text output of the table.

"none"
Supresses any printing. Useful, for example, when just assignment of the resulting object is desired.

"show"
Calls the default showDefault method, which will just print out the cgPairedDifferenceVatianceTable object components.

...
Additional arguments. Currently none are valid.

Value

Creates an object of class cgPairedDifferenceVarianceTable, with the following slots:
contents
The table of variance component estimates. There are two, the "within experimental unit" variance and the "between experimental unit" variance. See below for the data frame structure of the table. The label portion "experimental unit" will be replaced by the expunitname component of the settings slot of the cgPairedDifferenceFit fit object, if previously specified.
efficiency
A table of efficiency estimates, derived from the variance component estimates. The goal is to quantify the reduced number of experimental units needed since a paired difference design was employed, instead of a an unpaired design. See below for the data frame structure of the table.
settings
A list of settings carried from the cgPairedDifferenceFit fit object. These are used for the print.cgPairedDifferenceVarianceTable method, invoked for example when display="print".
The data frame structure of the variance components table from the classical least squares fit is provided in the contents slot. The data frame consists of row.names based on the expunitname component of the settings slot in the cgPairedDifferenceFit fit object. The first row is for the "within" component, and the second is for the "between" component. The "total" variance is in the third row of the table, the sum of the between and within variance components. The first column of the table is the variance components estimates, and the third column is the square root of the variance components, labeled Spread(StdDev). In the second column is the Percent calculation of the two variance components relative to the total sum variance.The data frame structure of the efficiency table from the classical least squares fit is provided in the efficiency slot. There are four rows and one column. All values are derived from the variance components estimates in the contents slot described above. The first row of Relative Efficiency comes from dividing the total variance by the between experimental unit variance component. The second row expresses the estimated gain in sensitivity by using a paired difference design and analysis over using a unpaired design and analysis. This is equal to the within experimental unit variance component divided by the total variance, and is expressed here as Percent Reduction. The third row is the number of experimental units based on the input data set paired structure. The last row contains the estimated number of unpaired design experimental units that would have been needed for the same sensitivity. The label portion "experimental unit" in these last two row names will be replaced by the expunitname component of the settings slot of the cgPairedDifferenceFit fit object if previously specified.

Details

The returned table contains variance component estimates for the classical least squares fit. There is no analogous decomposition of variance component estimates calculated for the resistant & robust fit.

Examples

Run this code
data(anorexiaFT)
anorexiaFT.data <- prepareCGPairedDifferenceData(anorexiaFT, format="groupcolumns",
                                                 analysisname="Anorexia FT",
                                                 endptname="Weight",
                                                 endptunits="lbs",
                                                 expunitname="Patient",
                                                 digits=1, logscale=TRUE)
anorexiaFT.fit <- fit(anorexiaFT.data)

varianceTable(anorexiaFT.fit)

Run the code above in your browser using DataLab