get_random | R Documentation |
Get coefficients for the random intercepts and random slopes.
get_random(model, cond = NULL, print.summary = getOption("itsadug_print"))
model |
A gam object, produced by |
cond |
A named list of the values to restrict the estimates for the random predictor terms. When NULL (default) all levels are returned. Only relevant for complex interactions, which involve more than two dimensions. |
print.summary |
Logical: whether or not to print a summary of the
values selected for each predictor.
Default set to the print info messages option
(see |
The coefficients of the random intercepts and slopes.
Jacolien van Rij
Other Model predictions:
get_coefs()
,
get_difference()
,
get_fitted()
,
get_modelterm()
,
get_predictions()
data(simdat) ## Not run: # Condition as factor, to have a random intercept # for illustration purposes: simdat$Condition <- as.factor(simdat$Condition) # Model with random effect and interactions: m2 <- bam(Y ~ s(Time) + s(Trial) + ti(Time, Trial) + s(Condition, bs='re') + s(Time, Subject, bs='re'), data=simdat) # extract all random effects combined: newd <- get_random(m2) head(newd) # extract coefficients for the random intercept for Condition: # Make bar plot: barplot(newd[[1]]) abline(h=0) # or select: get_random(m2, cond=list(Condition=c('2','3'))) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.