santaR_fit: Generate a SANTAObj for a variable

View source: R/santaR_fit.R

santaR_fitR Documentation

Generate a SANTAObj for a variable

Description

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:

SANTAObj santaR object for futher analysis
SANTAObj$properties$df input degree of freedom
SANTAObj$properties$CBand$status Confidence Bands for group mean curve calculated (TRUE or FALSE)
SANTAObj$properties$CBand$nBoot parameter, number or bootstrap rounds for calculation of the group mean curve confidence bands
SANTAObj$properties$CBand$alpha parameter, confidence of the group mean curve band
SANTAObj$properties$pval.dist$status p-value distance calculated (TRUE or FALSE)
SANTAObj$properties$pval.dist$nPerm parameter, number of permutations for calculation of distance p-value
SANTAObj$properties$pval.dist$alpha parameter, confidence on the bootstrapped p-value
SANTAObj$properties$pval.fit$status p-value fitting calculated (TRUE or FALSE)
SANTAObj$properties$pval.fit$nPerm parameter, number of permutations for calculation of fitting p-value
SANTAObj$properties$pval.fit$alpha parameter, confidence on the bootstrapped p-value
SANTAObj$general$inputData inputMatrix
SANTAObj$general$cleanData.in only kept individuals INPUT values (equivalent to inputMatrix - rejected)
SANTAObj$general$cleanData.pred only kept individuals PREDICTED values on Ind splines
SANTAObj$general$grouping grouping vector given as input
SANTAObj$general$meanCurve spline fit over all kept datapoint (cleanData.pred) | smooth.spline object
SANTAObj$general$pval.curveCorr Pearson correlation coefficient between the two group curves, to detect highly correlated group shapes if required.
SANTAObj$general$pval.dist p-value between groups based on distance between groupMeanCurves
SANTAObj$general$pval.dist.l lower bound confidence interval on p-value
SANTAObj$general$pval.dist.u upper bound confidence interval on p-value
SANTAObj$general$pval.fit p-value between groups based on groupMeanCurves fitting
SANTAObj$general$pval.fit.l lower bound confidence interval on p-value
SANTAObj$general$pval.fit.u upper bound confidence interval on p-value
SANTAObj$groups list of group information
SANTAObj$groups$rejectedInd list of rejected individual (#tp < 4 or df) | data
SANTAObj$groups$curveInd list of spline fit | smooth.spline object
SANTAObj$groups$groupMeanCurve spline fit over groupData.pred | smooth.spline object
SANTAObj$groups$point.in all group points INPUT values (x,y) [kept individuals]
SANTAObj$groups$point.pred all group points PREDICTED values on Ind splines (x,y)
SANTAObj$groups$groupData.in only individuals from this group INPUT value (IND x TIME)
SANTAObj$groups$groupData.pred only individuals from this group PREDICTED values on Ind splines (x,y)

See Also

Other Analysis: get_grouping(), get_ind_time_matrix(), santaR_CBand(), santaR_auto_fit(), santaR_auto_summary(), santaR_plot(), santaR_pvalue_dist(), santaR_pvalue_fit(), santaR_start_GUI()

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)


santaR documentation built on May 24, 2022, 1:06 a.m.