View source: R/spline-prep_AHM1_10-14_Prepare_input_spline.R
spline.prep | R Documentation |
Function chooses knots and creates design matrices for fixed and random-effects parts of a spline model for a chosen covariate. Based on code by Crainiceanu et al. (2005) and Zuur et al. (2012). Allows you to choose number of knots or else uses it by the rule given in Crainiceanu et al. (2005). Prepares fixed part of covariate as a quadratic polynomial.
spline.prep(cov, nknot = NA)
cov |
the covariate, a numeric vector |
nknot |
optional, number of knots |
A list with the following elements:
cov |
The input covariate |
knots |
The values of the knots |
X |
The fixed-effects design matrix |
Z |
The random-effects design matrix |
Marc Kéry & Andy Royle
Crainiceanu, C.M., Ruppert, D., & Wand, M.P. (2005) Bayesian analysis for penalized spline regression using WinBUGS. Journal of Statistical Software, 14.
Zuur, A.F., Saveliev, A.A., Ieno, E.N. (2012) Zero-inflated Models and Generalized Linear Mixed Models with R. Highlands Statistics
Kéry, M. & Royle, J.A. (2016) Applied Hierarchical Modeling in Ecology AHM1 - 10.14.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.