observations: Number of observations in the model.

View source: R/util.R

observationsR Documentation

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

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)


itsadug documentation built on June 17, 2022, 5:05 p.m.