Description Usage Arguments Details Value Note Author(s) References See Also Examples
Provides an interface to P. C. Phillips's implementation of Flury's algorithm for computing common principal components
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)
|
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 |
verbose |
print debugging information? |
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).
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.
The list returned by read.cpc
consists of:
the CPC eigenvector matrix returned by the CPC program
the p-value for the test of 1 CPC vs unrelated matrices
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)
a list for the pooled hypothesis
a list for the proportional hypothesis
Ben Bolker
Uses CPC V0.96 (c) 1994-1999 Patrick C. Phillips, pphillips@uta.edu
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.