Learn R Programming

itsadug (version 2.4.1)

observations: Number of observations in the model.

Description

Number of observations in the model.

Usage

observations(model)

Arguments

model

A fitted regression model (using gam, bam, (g)lm, (g)lmer).

Value

Numeric value: number of observations that are considered by the model.

See Also

Other Utility functions: convertNonAlphanumeric(), corfit(), diff_terms(), find_difference(), missing_est(), modeledf(), print_summary(), refLevels(), res_df(), summary_data(), timeBins()

Examples

Run this code
# NOT RUN {
data(simdat)
# simulate some missing data:
simdat[sample(1:nrow(simdat), size=15),]$Y <- NA
simdat[sample(1:nrow(simdat), size=7),]$Group <- NA

# Fit simple GAM models:
gam1 <- bam(Y ~ s(Time), data=simdat, discrete=TRUE)
gam2 <- bam(Y ~ Group + s(Time, by=Group), data=simdat, discrete=TRUE)

# number of data points in data frame:
nrow(simdat)

# observations model gam1:
observations(gam1)
# observations model gam2:
observations(gam2)

# }

Run the code above in your browser using DataLab