Learn R Programming

cg (version 1.0-3)

globalTest.cgOneFactorFit: Perform a global Test of significance with cgOneFactorFit object

Description

Performs a global test based on the cgOneFactorFit object, to assess whether there are any significant differences amongst levels of the factor, i.e. amongst the groups. A cgOneFactorGlobalTest class object is created.

Usage

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

Arguments

fit
A fit object of class cgOneFactorFit.
display
One of three valid values:
"print"
The default value; It calls a print method for the created globalTest.cgOneFactorFit object, which is formatted text output of the test p-values.

"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 globalTest.cgOneFactorFit components.

...
Additional arguments. Only one is currently valid:
model
For cgOneFactorFit objects that have classical least squares lm() or resistant & robust rlm() fits, the following argument values are possible:
"both"
Global tests on both the ordinary classical least squares and resistant robust fits are performed. This is the default when both fits are present in the cgOneFactorFit object specified in the fit argument.

"olsonly"
Only a global test on the ordinary classical least squares olsfit fit is performed.

"rronly"
Only a global test on the resistant and robust rrfit fit is performed.

For other possible cgOneFactorFit fit components such as accelerated failure time or unequal variance models, the model argument is not relevant, and the appropriate global test will be detected and performed for these model types.

Value

Creates an object of class cgOneFactorGlobalTest, with the following slots:
ols.gpval
The p-value of a global F test applied to the olsfit component of the cgOneFactorFit object, unless model="rronly" is specified. Will not be appropriate in the case where a valid aftfit component is present in the cgOneFactorFit object.
rr.gpval
The p-value of an ad-hoc global test applied to the rrfit component of the cgOneFactorFit object, if a valid resistant & robust fit object is present. See the Details section above. If rrfit is a simple character value of "No fit was selected.", or model="olsonly" was specified, then the value is NULL.
aft.gpval
The p-value of a global chi-square test applied to the aftfit component of the cgOneFactorFit object if a valid accelerated failure time fit object is present. If aftfit is a simple character value of "No fit was selected.", then the value is NULL.
uv.gpval
The p-value of a global F test applied to the uvfit component of the cgOneFactorFit object if a valid unequal variances fit object is present.

Details

The notion of a global F test, or equivalently, of $R^2$, for resistant & robust linear models is murky, as no clear theoretical analogue to the ordinary classical least squares approach exists. The approach taken here is ad-hoc, which is essentially to re-fit a linear model with lm() and weights from the resistant & robust fit. This ad-hoc approach is taken when there are 3 or more groups.

If there are only 2 groups, then the comparisonsTable.cgOneFactorFit method is used with the rlm() model component.

Examples

Run this code
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)

canine.globalTest <- globalTest(canine.fit)

globalTest(canine.fit, model="both")

globalTest(canine.fit, model="olsonly")

globalTest(canine.fit, model="rronly")


data(gmcsfcens)
gmcsfcens.data <- prepareCGOneFactorData(gmcsfcens, format="groupcolumns",
                                         analysisname="cytokine",
                                         endptname="GM-CSF (pg/ml)",
                                         logscale=TRUE)

gmcsfcens.fit <- fit(gmcsfcens.data, type="aft")

globalTest(gmcsfcens.fit)

Run the code above in your browser using DataLab