Description Usage Arguments Details Value
find_gam_deriv()
Finds a derivative with standard errors of smooth curves from gam model fit by finite differencing. Crucially it computes the probability that derivative is negative at each point.
1 2 3 4 5 6 7 8 9 10 11 | find_gam_deriv(gam_fit, n_points = 200, x = NULL, N_smooths = 9,
weights = list(rep(1, 200), sqrt(seq(1, 0, length.out = 200)), 1/(1 +
seq(1, 0, length.out = 200)^3))[[1]], d = 1/n_points,
return_gam = FALSE)
## S3 method for class 'gam_deriv'
summary(derivs)
## S3 method for class 'gam_deriv'
plot(derivs, features = derivs$derivs$y_name,
title = "First derivative of GAM model: gene expression = function(distance from archetype)")
|
gam_fit |
a fitted gam object as produced by gam(). |
n_points |
number of points at which to evaluate derivative |
x |
numeric vector where to evaluate derivatives |
N_smooths |
number of bases used to represent the smooth term (s), 4 for cubic splines |
weights |
how to weight points along x axis when calculating mean (integral) probability |
d |
numeric vector (1L), finite difference interval |
return_gam |
return gam model as well? By default only only the first derivative at n_points |
Plot method uses ggplot() to show mean derivative and confidence intervals (2 SD from the mean). This code is a modification of last example in predict.gam.
find_gam_deriv()
list (S3 object, find_gam_deriv) containing function call, a data.table with values of the first derivative, GAM model fit summary (gam_sm) and (optionally) gam model fit; summary entry is NA.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.