Wraps Principal Components Analysis (PCA) to extract component loadings.

Construct S3 class for pensieve.

Check S3 class.

Plot S3 class.

extract(cors, nfactors, fa_type = "pca")

QLoas(loas, validate = TRUE)

# S3 method for QLoas
check(x)

# S3 method for QLoas
plot(x, summarize = NULL, by = "people", r2 = FALSE, use_js = NULL, ...)

Arguments

cors

A numerical matrix with correlations.

nfactors

Positive, non-zero integer scalar, giving the number of components (or factors) to retain. Must be smaller than the number of observations (here: items) on which cors are based.

fa_type

String giving the type of factor analysis performed. Currently only "pca" for principal components analysis (PCA) is allowed.

loas

A numerical matrix with loadings.

validate

a logical flag, indicating whether the object will be validated on construction. Defaults to TRUE.

x

class object created by respective constructor function.

summarize

A logical flag, indicating whether the object should be summarized before plotting. If TRUE, a plot with a density estimate of individual data points is returned, suitable for medium to large objects (numbers of people-variables). If FALSE, a plot with individual data points is returned, suitable for small to medium-sized objects (numbers of people-variables).

Defaults to NULL, in which case the appropriate plot is inferred from the size.

by

A character string indicating by which dimension to plot. Must be "people" or "both". Display by "factor" is not currently available.

r2

Logical flag, indicating whether the squared loadings should be plotted. If FALSE, loadings are plotted, interpretable as correlations of people-variables with factors. If TRUE, squared loadings are plotted, interpretable as the share of explained variance. Defaults to FALSE.

use_js

A logical flag, indicating whether an interactive, java-script variant of the plot should be returned. Defaults to NULL, in which case the appropriate output is inferred from the runtime environment.

...

Arguments passed onto other methods. Not currently used.

Methods (by generic)

  • check: validation

  • plot: plotting

See also

Other analysis functions: correlate(), score()

Other S3 classes from pensieve: correlate(), psClosedSorts(), psGrid(), psItemContent(), psOpenSorts(), psOpenSort(), psPeople(), score()

Other plotting functions: correlate(), psClosedSorts()

Examples

# this just runs the calculations, but also classes and validates the results cors <- correlate(csorts = civicon_2014$qData$sorts[,,"before"]) # preliminary step loas <- extract(cors = cors, nfactors = 3, fa_type = "pca") # this just assigns the class, without validation (not recommended) loas <- QLoas(loas = loas, validate = FALSE) # this validates the class check(loas)
#> [1] TRUE
# makes a barchart plot(x = loas, use_js = NULL, by = "people")
plot(x = loas, use_js = NULL, by = "both")
#> Warning: Removed 54 rows containing missing values (geom_tile).
#> Warning: Removed 54 rows containing missing values (geom_text).