varianceTable.cgPairedDifferenceFit: Compute Variances from a cgPairedDifferenceFit object

Description Usage Arguments Details Value Note Author(s) Examples


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


## S4 method for signature 'cgPairedDifferenceFit'
varianceTable(fit, display = "print", ...)



A cgPairedDifferenceFit object, typically created by fit.cgPairedDifferenceData.


One of three valid values:


The default value; It calls a print method for the created
cgPairedDifferenceVarianceTable object, which is a formatted text output of the table.


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


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


Additional arguments. Currently none are valid.


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.


Creates an object of class cgPairedDifferenceVarianceTable, with the following slots:


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.


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.


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.


Contact for bug reports, questions, concerns, and comments.


Bill Pikounis [aut, cre, cph], John Oleynick [aut], Eva Ye [ctb]


data(anorexiaFT) <- prepareCGPairedDifferenceData(anorexiaFT, format="groupcolumns",
                                                 analysisname="Anorexia FT",
                                                 digits=1, logscale=TRUE) <- fit(


Search within the cg package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.