knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

fpcaCor

The R package "fpcaCor" has one main function 'fpcaCor'. For given data matrix X, it extracts the eigen-functions for a given 'pve' or supplied 'pcv'.

Introduction

We consider given $X_i(t)$, $t=1, \dots, T$, $i = 1, \dots, n$. For simplicity, we will assume that the data start with the same time points $t$ across subjects and equi-distant time points. Instead of covariance matrix, we want to work on a sample correlation matrix $\hat{K} \in \mathbb{R}^{T \times T}$ based on latent Gaussian copulas. Then by finding appropriate method to get a smooth $\tilde{K}$ from the correlation matrix $\hat{K}, we will obtain the eigen-functions of $\tilde{K}$ . The function "fpcacor" extract eigen-functions of the smoothed matrix $\tilde{K}$.

Installation

You can install the development version of fpcaCor from GitHub with:

# install.packages("devtools")
devtools::install_github("gozdesert/fpcaCor")

Example

library(fpcaCor)
## basic example code
set.seed(46933)
### Generate data using the function "gaussian_copula_cor" :
n = 33  # number of samples
ntime = 20  # number of time points
Mydata.X = gaussian_copula_cor(n = 33, ntime = 20)$Y   #A n x ntime matrix for the Gaussian latent model
fpcaCor(X = Mydata.X, pve = 0.999999)  #Default value for pve = 0.99


gozdesert/fpcaCor documentation built on Feb. 13, 2022, 6:31 p.m.