Implements the cross-validation described in Davison & Davenport (2002).
pcv(formula, data, seed =NULL, na.action ="na.fail", family ="gaussian", weights =NULL)
Arguments
formula: An object of class formula of the form response ~ terms.
data: An optional data frame, list or environment containing the variables in the model.
seed: Should a seed be set? Function defaults to a random seed.
na.action: How should missing data be handled? Function defaults to failing if missing data are present.
family: A description of the error distribution and link function to be used in the model. See family.
weights: An option vector of weights to be used in the fitting process.
Returns
An object of class critpat is returned, listing the f ollowing components:
R2.full, test of the null hypothesis that R2 = 0
R2.pat, test that the R2_pattern = 0
R2.level, test that the R2_level = 0
R2.full.lvl, test that the R2_full = R2_level = 0
R2.full.pat, test that the R2_full = R2_pattern = 0
Details
The pcv function requires two arguments: criterion and predictor. The criterion corresonds to the dependent variable and the predictor corresponds to the matrix of predictor variables. The function performs the cross-validation technique described in Davison & Davenport (2002) and an object of class critpat is returned. There the following s3 generic functions are available: summary(),anova(), print(), and plot(). These functions provide a summary of the cross-validation (namely, R2); performs ANOVA of the R2 based on the split for the level, pattern, and overall; provide output similar to lm(); and plot the estimated parameters for the random split. Missing data are presently handled by specifying na.action = "na.omit", which performs listwise deletion and na.action = "na.fail", the default, which causes the function to fail. A seed may also be set for reproducibility by setting the seed.
References
Davison, M., & Davenport, E. (2002). Identifying criterion-related patterns of predictor scores using multiple regression. Psychological Methods, 7(4), 468-484. DOI: 10.1037/1082-989X.7.4.468.