Function for extracting parameter estimates from fitted splines on a specified interval.

estimateSplineParameters(
  HTPSpline,
  estimate = c("predictions", "derivatives", "derivatives2"),
  what = c("min", "max", "mean", "AUC", "p"),
  AUCScale = c("min", "hour", "day"),
  timeMin = NULL,
  timeMax = NULL,
  genotypes = NULL,
  plotIds = NULL
)

Arguments

HTPSpline

An object of class HTPSpline, the output of the fitSpline function.

estimate

The P-Spline component for which the estimate should be extracted, the predictions, the first derivatives or the second derivatives ("derivatives2")

what

The types of estimate that should be extracted. Either minimum ("min"), maximum ("max"), mean, area under the curve ("AUC") or a percentile. Percentiles should be given as p + percentile. E.g. for the 10th percentile specify what = "p10". Multiple types of estimate can be extracted at once.

AUCScale

The area under the curve is dependent on the scale used on the x-axis. By default the area is computed assuming a scale in minutes. This can be changed to either hours or days.

timeMin

The lower bound of the time interval from which the estimates should be extracted. If NULL the smallest time value for which the splines were fitted is used.

timeMax

The upper bound of the time interval from which the estimates should be extracted. If NULL the largest time value for which the splines were fitted is used.

genotypes

A character vector indicating the genotypes for which estimates should be extracted. If NULL, estimates will be extracted for all genotypes for which splines where fitted.

plotIds

A character vector indicating the plotIds for which estimates should be extracted. If NULL, estimates will be extracted for all plotIds for which splines where fitted.

Value

An object of class HTPSplineEst, a data.frame containing the estimated parameters.

See also

Other functions for spline parameter estimation: plot.HTPSplineEst()

Examples

## Run the function to fit P-splines on a subset of genotypes. subGeno <- c("G160", "G151") fit.spline <- fitSpline(inDat = spatCorrectedVator, trait = "EffpsII_corr", genotypes = subGeno, knots = 50) ## Estimate the maximum value of the predictions at the beginning of the time course. paramVator <- estimateSplineParameters(HTPSpline = fit.spline, estimate = "predictions", what = "max", timeMin = 1527784620, timeMax = 1528500000, genotypes = subGeno) head(paramVator)
#> genotype plotId max_predictions max_timeNumber max_timePoint #> 1 G151 c13r1 0.6878932 0 2018-05-31 16:37:00 #> 2 G151 c15r48 0.6955162 663200 2018-06-08 08:50:20 #> 3 G151 c1r16 0.6878921 665600 2018-06-08 09:30:20 #> 4 G151 c21r25 0.7757065 168000 2018-06-02 15:17:00 #> 5 G151 c2r7 0.6897501 477600 2018-06-06 05:17:00 #> 6 G151 c6r46 0.6916913 344800 2018-06-04 16:23:40
## Estimate the minimum and maximum value of the predictions. paramVator2 <- estimateSplineParameters(HTPSpline = fit.spline, estimate = "predictions", what = c("min", "max"), genotypes = subGeno) head(paramVator2)
#> genotype plotId min_predictions min_timeNumber min_timePoint #> 1 G151 c13r1 0.4103549 792000 2018-06-09 20:37:00 #> 2 G151 c15r48 0.3558782 768000 2018-06-09 13:57:00 #> 3 G151 c1r16 0.3757698 766400 2018-06-09 13:30:20 #> 4 G151 c21r25 0.2351897 786400 2018-06-09 19:03:40 #> 5 G151 c2r7 0.3565921 769600 2018-06-09 14:23:40 #> 6 G151 c6r46 0.3619749 769600 2018-06-09 14:23:40 #> max_predictions max_timeNumber max_timePoint #> 1 0.7409539 1206400 2018-06-14 15:43:40 #> 2 0.7371926 1198400 2018-06-14 13:30:20 #> 3 0.7300670 1202400 2018-06-14 14:37:00 #> 4 0.7757065 168000 2018-06-02 15:17:00 #> 5 0.7369606 1192800 2018-06-14 11:57:00 #> 6 0.7322004 1199200 2018-06-14 13:43:40