Check whether there are sufficient observations to run a model
check_observations(x, ...)# S3 method for data.frame
check_observations(
x,
model,
count_col = "count",
year_col = "year",
month_col = NULL,
covars = character(0),
changepoints = numeric(0),
eps = 1e-08,
...
)
# S3 method for trimcommand
check_observations(x, ...)
# S3 method for character
check_observations(x, ...)
A trimcommand object, a data.frame, or the location of a TRIM command file.
Parameters passed to other methods.
[numeric] Model 1, 2 or 3?
[character|numeric] column index of the counts in x
[character|numeric] column index of years or time points in x
[character|numeric] optional column index of months in x
[character|numeric] column index of covariates in x
[numeric] Changepoints (model 2 only)
[numeric] Numbers whose absolute magnitude are lesser than eps are considered zero.
A list with two components. The component sufficient takes the value
TRUE or FALSE depending on whether sufficient counts have been found.
The component errors is a list, of which the structure depends on the chosen model,
that indicates under what conditions insufficient data is present to estimate the model.
For model 3 without covariates, $errors is a list whose single element is a vector of time
points with insufficient counts.
For model 3 with covariates, $errors is a named list with an element for each covariate
for which insufficients counts are encountered. Each element is a two-column data.frame. The
first column indicates the time point, the second column indicates for which covariate value insufficient
counts are found.
For Model 2, without covariates $errors is a list with a single
element changepoints. It points out what changepoints lead to a time
slice with zero observations.
For Model 2, with covariates $errors is a named list with an
element for each covariate for which inssufficients counts are encountered.
Each element is a two-column data.frame, The first colum indicates the
changepoint, the second column indicates for which covariate value
insufficient counts are found.
Other modelspec:
read_tcf(),
read_tdf(),
set_trim_verbose(),
trimcommand(),
trim()