Learn R Programming

traj (version 1.2)

step2factors: Performs Factor Analysis to Select a Subset of the 24 Measures

Description

Performs a factor analysis to reduce the set of 24 measures into a smaller set of measures that captures the main features of the trajectories.

Usage

step2factors(trajMeasures, num.factors = NULL, discard = NULL, verbose = TRUE, ...)

Value

trajFactors

Object containing the measures chosen as factors, the eigenvalues of the correlation matrix of the 24 measures, the list generated by the principal function used for the factor analysis and the data stored in the trajMeasures object.

Arguments

trajMeasures

List generated by step1mesures. Contains original data, original time and 24 measures.

discard

Vector containing names or numerical positions of measures to discard during factor analysis. See details.Defaults to NULL.

num.factors

Numerical value specifying the number of factors to choose. Defaults to NULL.

verbose

Logical indicating if the function should print information on screen. Defaults to TRUE

...

Arguments to be passed to principal. See details.

Author

Dan Vatnik, Marie-Pierre Sylvestre
dan.vatnik@gmail.com

Details

If num.factor is NULL,the function will select the number of factors as the number of eigenvalues greater than 1.

The principal function is used in order to choose the measure that will represent each factor. varimax is used to rotate the data during the execution of theprincipal function. Any other parameter can be passed through ... in order to further control the principal function.

If any measures that happen to be extremely correlated among themselves(corr. >= 0.95), one of them will have to be removed. Such measures are flagged by step1measures. These values can be removed with discard or they will be automatically removed by the function.

See Also

principal step1measures

Examples

Run this code
# Setup data and time
data = example.data$data
time = example.data$time

# Run step1measures and step2factors
s1 = step1measures(data,time, ID=TRUE)
s2 = step2factors(s1)

# Display factors
head(s2$factors)

# The next step would be to run "step3clusters"

Run the code above in your browser using DataLab