View source: R/semiparametric_models.R
penalized_spline_model | R Documentation |
Penalized Spline model
penalized_spline_model(
age,
pos = NULL,
tot = NULL,
status = NULL,
s = "bs",
link = "logit",
framework = "pl",
sp = NULL
)
age |
the age vector |
pos |
the positive count vector (optional if status is provided). |
tot |
the total count vector (optional if status is provided). |
status |
the serostatus vector (optional if pos & tot are provided). |
s |
smoothing basis to use |
link |
link function to use |
framework |
which approach to fit the model ("pl" for penalized likelihood framework, "glmm" for generalized linear mixed model framework) |
sp |
smoothing parameter |
a list of class penalized_spline_model with 6 attributes
datatype |
type of datatype used for model fitting (aggregated or linelisting) |
df |
the dataframe used for fitting the model |
framework |
either pl or glmm |
info |
fitted "gam" model when framework is pl or "gamm" model when framework is glmm |
sp |
seroprevalence |
foi |
force of infection |
[mgcv::gam()], [mgcv::gamm()] for more information the fitted gam and gamm model
data <- parvob19_be_2001_2003
model <- penalized_spline_model(data$age, status = data$seropositive, framework="glmm")
model$info$gam
plot(model)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.