View source: R/extended_s3_methods.R
nobs.drift_dm | R Documentation |
This method retrieves the total number of observations in the obs_data
list of a drift_dm
object.
## S3 method for class 'drift_dm'
nobs(object, ...)
object |
a drift_dm object, which contains the observed data
in |
... |
additional arguments |
The function iterates over each element in object$obs_data
, counts
the entries in each nested component, and returns the cumulative sum as the
total observation count.
It was written to provide an nobs
method for calculating the log-likelihood
(logLik), AIC (stats::AIC), and BIC (stats::BIC) statistics
for objects of type drift_dm.
An integer representing the total number of observations across
all conditions in object$obs_data
.
# get a pre-built model and data set for demonstration purpose
a_model <- dmc_dm()
obs_data(a_model) <- dmc_synth_data
# then get the number of observations by accessing the model
nobs(a_model)
# same number of observations as in the original data set
nrow(dmc_synth_data)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.