princals: Categorical principal component analysis (PRINCALS).

Description Usage Arguments Details Value References See Also Examples

View source: R/princals.R

Description

Fits a categorical PCA. The default is to take each input variable as ordinal but it works for mixed scale levels (incl. nominal) as well. Through a proper spline specification various continuous transformation functions can be specified: linear, polynomials, and (monotone) splines.

Usage

1
2
3
princals(data, ndim = 2, ordinal = TRUE, ties = "s", knots = knotsGifi(data, "D"), 
degrees = 2, copies = 1, missing = "m", normobj.z = TRUE, active = TRUE,
itmax = 1000, eps = 1e-06, verbose = FALSE)

Arguments

data

Input data frame: n observations, m variables

ndim

Number of dimensions to be computed

ordinal

Whether variables should be considered as ordinal or not. Alternatively, one can specify a boolean vector of length m denoting which variables should be ordinally restricted or not.

ties

How ties should be handled: primary ("p"), secondary ("s"), or tertiary ("t")

knots

Knots specification for spline transformation (see knotsGifi)

degrees

Spline degrees. If different degrees should be used across variables, a vector of length m can be specified.

copies

Number of copies for each variables (also as vector of length m)

missing

How missing values should be handled: multiple ("m"), single ("s"), or average ("a")

active

Which variables should be active or inactive (also as vector of length m)

normobj.z

If TRUE, object scores are z-scores, if FALSE, they are restriction to SS of 1.

itmax

Maximum number of iterations

eps

Convergence criterion

verbose

Iteration printout

Details

Fits PRINCALS as described in De Leeuw et al. (2017).

Value

transform

Optimally transformed scores

rhat

Induced correlation matrix

evals

Eigenvalues of induced correlation matrix

objectscores

Object scores (rows)

scoremat

Optimally scaled data matrix (first dimension)

quantifications

Category quantifications

dmeasures

Discimination matrices

lambda

Average discrimination matrix

weights

Component weights

loadings

Component loadings

ntel

Number of iterations

f

Loss function value

data

Original data frame

datanum

Numerical data frame

ndim

Number of extracted dimensions

call

Function call

References

Gifi, A. (1990). Nonlinear Multivariate Analysis. New York: Wiley.

De Leeuw, J., Mair, P., Groenen, P. J. F. (2017). Multivariate Analysis with Optimal Scaling. http://gifi.stat.ucla.edu/gifi/_book/.

See Also

homals, plot.princals

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
ABC6 <- ABC[,6:11]

## ordinal PCA
fitord <- princals(ABC6)  ## ordinal PCA
fitord
summary(fitord)

plot(fitord, plot.type = "transplot")
plot(fitord, "loadplot", main = "Loadings Plot ABC Data")  ## aspect ratio = 1
plot(fitord, "biplot", labels.scores = TRUE, main = "Biplot ABC Data")
plot(fitord, "screeplot")

## linear restrictions (mimics standard PCA)
abc_knots <- knotsGifi(ABC6, "E")     ## 0 interior knots
fitlin <- princals(ABC6, knots = abc_knots, degrees = 1)  
fitlin 
fitlin$evals
plot(fitlin, plot.type = "transplot")

## compare with standard PCA
ABCnum <- makeNumeric(ABC6)
fitpca <- prcomp(ABCnum, scale = TRUE)
fitpca$sdev^2   

## more complicated specifications
## Not run: 
data(epi.bfi, package = "psych")
epi6 <- epi.bfi[,1:6]
fitepi1 <- princals(epi6, knots = knotsGifi(epi6, "Q"))    ## monotone splines (degree 2)
fitepi1
plot(fitepi1, "transplot")

## no interior knots vars 1 and 2; data knots vars 3 and 4; 5 
## interior percentile knots var 5; no interior knots var 6)
knotList <- c(knotsGifi(epi6[,1:2], "E"), 
              knotsGifi(epi6[,3:4], "D"), 
              knotsGifi(epi6[,5], "Q", n = 5),
              knotsGifi(epi6[,6], "E"))
knotList  
ordvec <- c(TRUE, FALSE, TRUE, FALSE, FALSE, TRUE) ## ordinal restrictions
degvec <- c(3, -1, 2, 2, 3, 1)                     ## spline degrees (second variable nominal)
fitepi2 <- princals(epi6, knots = knotList, ordinal = ordvec, degrees = degvec)
fitepi2
plot(fitepi2, "transplot")

## End(Not run)

Gifi documentation built on Oct. 2, 2018, 3:01 p.m.