Skip to contents

Generate a SANTAObj containing all the splines model for individual and group time evolutions. Once all the splines representing individual and group evolutions are fitted, all time-points are back-projected (projected) and employed in subsequent analysis in place of the input measurements (functional approach). A grouping can be provided to separate individuals and compare trajectories: any number of groups can be provided, but comparision of group trajectories can only be executed between 2 groups.

  • Individual trajectories with less than 4 time-points are rejected due to constraints on smooth.spline fitting (number of time-points < 4).

  • Individual trajectories with less time-points than df are rejected due to constraints on smooth.spline fitting (number of time-points < df).

  • Rejected individual trajectories are not taken into account for mean curves calculations.

Usage

santaR_fit(inputMatrix, df, grouping = NA, verbose = TRUE)

Arguments

inputMatrix

data.frame of measurements for each IND x TIME as generated by get_ind_time_matrix. Rows are unique Individual IDs and columns unique measurement Time. Pairs of (IND,TIME) without a measurement are left as NA.

df

(float) Degree of freedom to employ for fitting the smooth.spline

grouping

NA or a data.frame with 2 columns (ind and group) listing as rows each unique Individual ID and the corresponding group membership, as generated by get_grouping. Default is NA for no groups.

verbose

(bool) If TRUE output the progress of fitting. Default is TRUE.

Value

A SANTAObj containing all the spline models with individual and group time evolutions, for further analysis.

Details:

The returned SANTAObj is structured as follow:

SANTAObjsantaR object for futher analysis
SANTAObj$properties$dfinput degree of freedom
SANTAObj$properties$CBand$statusConfidence Bands for group mean curve calculated (TRUE or FALSE)
SANTAObj$properties$CBand$nBootparameter, number or bootstrap rounds for calculation of the group mean curve confidence bands
SANTAObj$properties$CBand$alphaparameter, confidence of the group mean curve band
SANTAObj$properties$pval.dist$statusp-value distance calculated (TRUE or FALSE)
SANTAObj$properties$pval.dist$nPermparameter, number of permutations for calculation of distance p-value
SANTAObj$properties$pval.dist$alphaparameter, confidence on the bootstrapped p-value
SANTAObj$properties$pval.fit$statusp-value fitting calculated (TRUE or FALSE)
SANTAObj$properties$pval.fit$nPermparameter, number of permutations for calculation of fitting p-value
SANTAObj$properties$pval.fit$alphaparameter, confidence on the bootstrapped p-value
SANTAObj$general$inputDatainputMatrix
SANTAObj$general$cleanData.inonly kept individuals INPUT values (equivalent to inputMatrix - rejected)
SANTAObj$general$cleanData.predonly kept individuals PREDICTED values on Ind splines
SANTAObj$general$groupinggrouping vector given as input
SANTAObj$general$meanCurvespline fit over all kept datapoint (cleanData.pred) | smooth.spline object
SANTAObj$general$pval.curveCorrPearson correlation coefficient between the two group curves, to detect highly correlated group shapes if required.
SANTAObj$general$pval.distp-value between groups based on distance between groupMeanCurves
SANTAObj$general$pval.dist.llower bound confidence interval on p-value
SANTAObj$general$pval.dist.uupper bound confidence interval on p-value
SANTAObj$general$pval.fitp-value between groups based on groupMeanCurves fitting
SANTAObj$general$pval.fit.llower bound confidence interval on p-value
SANTAObj$general$pval.fit.uupper bound confidence interval on p-value
SANTAObj$groupslist of group information
SANTAObj$groups$rejectedIndlist of rejected individual (#tp < 4 or df) | data
SANTAObj$groups$curveIndlist of spline fit | smooth.spline object
SANTAObj$groups$groupMeanCurvespline fit over groupData.pred | smooth.spline object
SANTAObj$groups$point.inall group points INPUT values (x,y) [kept individuals]
SANTAObj$groups$point.predall group points PREDICTED values on Ind splines (x,y)
SANTAObj$groups$groupData.inonly individuals from this group INPUT value (IND x TIME)
SANTAObj$groups$groupData.predonly individuals from this group PREDICTED values on Ind splines (x,y)

Examples

## 56 measurements, 8 subjects, 7 unique time-points
Yi             <- acuteInflammation$data$var_1
ind            <- acuteInflammation$meta$ind
time           <- acuteInflammation$meta$time
group          <- acuteInflammation$meta$group
grouping       <- get_grouping(ind, group)
inputMatrix    <- get_ind_time_matrix(Yi, ind, time)
resultSANTAObj <- santaR_fit(inputMatrix, df=5, grouping=grouping, verbose=TRUE)