help for pcacoefsave

Save coefficients and other results of PCA to new dataset

pcacoefsave using
filename
[
, replace
rotated
comment(string)
]

Description

pcacoefsave saves coefficients and other results from a
principal component analysis (PCA) to a new Stata dataset. It is
essential that results from a previous application of pca be in
memory. The extension .dta will be added to the filename if not
specified.

New variables are (for p variables and m <= p components
from the PCA):

varname 1 to p, labelled with original variable name

varlabel 1 to p, labelled with original variable label

(labelled with original variable name if label is not defined)

PC 1 to m

corr correlation between PC and variable

loading coefficient or loading between PC and variable

eigenvalue eigenvalue by PC

mean mean by variable

SD SD by variable

Other than corr and loading the values of variables are
necessarily repeated by variable or PC, as each definition
requires.

The values of corr and loading are undefined (i.e. missing)
whenever components are not returned, i.e. whenever m < p.

Remarks

The purpose of pcacoefsave is to ease reporting
(including graphics) of PCA results. See pca postestimation for
documentation of what is already readily available.

Devotees of factor analysis should feel free to write their own
command or seek support elsewhere.

Options

replace specifies that an existing file with the same
name be replaced.

rotated specifies use of rotated results.

comment() adds a string variable comment with
stated contents. This is in support of the following goal: You intend to
run various applications of pca and seek to compare results. You
can specify pcacoefsave with comment identifying the nature of
each run before applying append.

Examples

. sysuse auto, clear

. pca headroom trunk weight length displacement

. pcacoefsave using pca_results

. use pca_results

. tabdisp varname PC, cell(corr) format(%4.3f)

. xtset PC varname

. xtline loading, overlay xla(, valuelabel) recast(connected) legend(pos(3) col(1)) yla(, ang(h))

(data from www.statisticalsleuth.com, case1701.csv)

. pca l*, cov

. pcacoefsave using pca_results

. use pca_results

. local opts ms(none) mla(PC) mlabpos(0) mlabsize(*1.5)

. twoway connected loading varn if PC == 1, `opts' || connected loading varn if PC == 2, `opts' || connected loading varn if PC == 3, `opts' legend(off) xla(1/11)

Author

Nicholas J. Cox, Durham University, U.K.

n.j.cox@durham.ac.uk

Also see

Online:
help for pca,
help for pca postestimation,
help for eofplot (if installed from SSC)