fpca

fPca

Description

Performs functional PCA training. The fPca action implements the Functional Principal Component Analysis (FPCA) method. It is used to reduce the dimensionality of functional data (curves or time series) by transforming them into a set of principal component scores, while generating eigenvalues and eigenvectors that describe the variation in the data.

fpca.fPca <result=results> <status=rc> / display={caseSensitive=TRUE|FALSE, exclude=TRUE|FALSE, ...} eigenVal={casouttable} eigenVec={casouttable} id={"variable-name-1" <, "variable-name-2", ...>} inputs={{casinvardesc-1} <, {casinvardesc-2}, ...>} nBins=integer output={casout={casouttable}, npc=integer} outputTables={outputTables} rankThreshold=double saveState={casouttable} * table={castable};
Settings
ParameterDescription
display Specifies a list of results tables to send to the client for display. Used to control the output appearing in the client.
eigenVal Specifies the output data table in which to save the eigenvalue matrix.
eigenVec Specifies the output data table in which to save the eigenvector matrix.
id Specifies the variable(s) to use as the record identifier for the functional curves.
inputs Specifies the variables to use in the analysis. These represent the measurements of the function across the domain.
nBins Specifies the number of bins to use in binning functional curves. Default is -1.
output Specifies the output data table in which to save the score values of the training data. Sub-parameters include 'casout' (table) and 'npc' (number of principal components).
outputTables Lists the names of results tables to save as CAS tables on the server.
rankThreshold Specifies the eigenvalue threshold to use in determining the covariance matrix rank. Default is 1E-08.
saveState Specifies the output data table in which to save the state of eigenvector matrix for future scoring (Analytic Store).
table Specifies the settings for the input table containing the functional data.
Data Preparation View data prep sheet
Create Functional Data

Generates a dataset with 100 observations, each containing 50 measurement points (y1-y50) representing a curve.

Copied!
1 
2DATA mycas.functional_data;
3DO id = 1 to 100;
4array y[50];
5DO i = 1 to 50;
6y[i] = sin(i/5) + (id/50) + rannor(1)*0.1;
7END;
8OUTPUT;
9END;
10drop i;
11 
12RUN;
13 

Examples

Performs FPCA on the variables y1 through y50, using 'id' as the identifier, and saves the scores to 'fpca_scores'.

SAS® / CAS Code Code awaiting community validation
Copied!
1 
2PROC CAS;
3fpca.fPca / TABLE={name="functional_data"} inputs={ "y1-y50" } id={"id"} OUTPUT={casout={name="fpca_scores", replace=true}, npc=3};
4 
5RUN;
6 
Result :
A CAS table named 'fpca_scores' containing the first 3 principal component scores for each ID.

Performs FPCA with binning options, saves eigenvalues and eigenvectors tables, and exports the model state for future scoring.

SAS® / CAS Code Code awaiting community validation
Copied!
1 
2PROC CAS;
3fpca.fPca / TABLE={name="functional_data"} inputs="y1-y50" id={"id"} nBins=20 rankThreshold=1E-6 eigenVal={name="evals", replace=true} eigenVec={name="evecs", replace=true} saveState={name="fpca_store", replace=true} OUTPUT={casout={name="scores_detail", replace=true}, npc=5};
4 
5RUN;
6 
Result :
Generates 'evals', 'evecs', 'scores_detail', and an analytic store 'fpca_store' table.

FAQ

What is the primary purpose of the fPca action?
Which parameter is mandatory to specify the input data?
How can I specify the variables to be used in the analysis?
What is the role of the 'id' parameter?
How do I save the trained model state for future scoring?
What does the 'nBins' parameter control?
Which parameters allow saving the eigenvalue and eigenvector matrices?
What is the default value for the 'rankThreshold' parameter?