phillips.cpc: Run Phillips's CPC program from R

Description Usage Arguments Details Value Note Author(s) References See Also Examples

Description

Provides an interface to P. C. Phillips's implementation of Flury's algorithm for computing common principal components

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
phillips.cpc(x, f, covs, npts,
                     progdir,
                     progname,
                     ansfn,
                     datfn,
                     outfn,
                     unlink.temp=TRUE,
                     use="complete.obs",verbose=FALSE)
phillips.cpcvec(x, f, covs, npts,
                     progdir,
                     progname,
                     ansfn,
                     datfn,
                     outfn,
                     unlink.temp=TRUE,
                     use="complete.obs")
read.cpc(outfn,ngrp,nvar,verbose=FALSE)
run.cpc(covs,npts,progdir,
                    progname,
                    ansfn,
                    datfn,
                    outfn)

Arguments

x

a numeric matrix (or data frame with all numeric values, or (if f is missing) a list of a data matrix and a grouping variable

f

a factor describing the group structure of the data

covs

list of pre-computed covariance matrices of all groups

npts

numeric vector, number of observations in each group

ansfn

file name for CPC control file

datfn

file name for CPC temporary data file

outfn

file name for CPC output file

unlink.temp

(logical) delete working files when finished?

progdir

(character) directory containing Phillips's CPC program

progname

(character) name of Phillips's CPC program

ngrp

(numeric) number of groups

nvar

(numeric) number of variables

use

method for missing observations when computing covariances (see cov for details)

verbose

print debugging information?

Details

phillips.cpc() is a wrapper for run.cpc(), which writes appropriate input files to disk and then calls Phillips's CPC program, and read.cpc(), which reads the resulting output file back into R. At the moment read.cpc() and phillips.cpc() only return the CPC eigenvector matrix, although they could be extended. phillips.cpcvec() is a wrapper for phillips.cpc() which returns only the common eigenvector matrix (rather than a longer list of results).

Value

run.cpc() returns nothing (it calls the CPC program which creates an output file). read.cpc() returns a long list (see below). phillips.cpcvec() returns just the eigenvector matrix.

Note

The list returned by read.cpc consists of:

evecs.CPC

the CPC eigenvector matrix returned by the CPC program

cpc1.pval

the p-value for the test of 1 CPC vs unrelated matrices

datlist

a list of lists for sub-hypotheses, each containing crit (criterion), par (number of parameters for the hypothesis), testmat (statistical test matrix), evals (list of eigenvalues for each group), evecs (eigenvector matrix or matrices), cov (list of variance-covariance matrices for each group)

pool

a list for the pooled hypothesis

propdat

a list for the proportional hypothesis

Author(s)

Ben Bolker

References

Uses CPC V0.96 (c) 1994-1999 Patrick C. Phillips, pphillips@uta.edu

See Also

pooled.cpc

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
   set.seed(1001)
   v = c(10,5,2,1)
   corr = c(0.8,0.6,0.5,0.5)
   X = simdata(npts=1000,vars=v,cors=corr)
   eigen(covmat(v,cor=corr))
   P1 = phillips.cpc(X)
   P1$cpc1.pval
   P1$evecs.CPC
   phillips.cpcvec(X)
   pooled.cpc(X)

bbolker/cpcbp documentation built on May 11, 2019, 9:28 p.m.