Description Usage Arguments Examples
View source: R/discont_basis.R
Provides set of basis functions on either side of a time point, allowing for a discontinuity in the fitted functions
1 2 3 4 5 6 7 8 9 10 |
timepoints |
vector of numeric timepoints for which the splines basis will be evaluated |
discont_point |
a single numeric value that represents where the discontinuity should be |
knots |
passed to |
dfPre |
the df for the basis functions defined before the discontinuity point |
dfPost |
the df for the basis functions defined after the discontinuity point |
degree |
passed to |
intercept |
Whether to include an intercept (vector of all 1s) for each side of the discontinuity. Note this is different than the argument |
type |
either "ns" or "bs" indicating which splines basis function should be used. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | x<-seq(0,10,length=100)
basis<-discont_basis(x,discont_point=3, dfPre=3, dfPost=4, intercept=TRUE)
# Plot of the basis functions
par(mfrow=c(3,3))
for(i in 1:ncol(basis)){
plot(x,basis[,i],type="l")
abline(v=3,lty=2)
}
# Use it in a moanin_model object instead of ns/bs:
data(exampleData)
moanin <- create_moanin_model(data=testData, meta=testMeta,
spline_formula=~Group:discont_basis(Timepoint,dfPre=3,
dfPost=3,discont=20,intercept=TRUE)+0,
degrees_of_freedom=6)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.