View source: R/extended_s3_methods.R
coef<- | R Documentation |
Extract or set the coefficients/parameters of drift_dm or
fits_ids_dm
objects
coef(object, ...) <- value
## S3 replacement method for class 'drift_dm'
coef(object, ..., eval_model = FALSE) <- value
## S3 method for class 'drift_dm'
coef(object, ..., select_unique = TRUE, select_custom_prms = TRUE)
## S3 method for class 'fits_ids_dm'
coef(object, ...)
## S3 method for class 'coefs_dm'
print(
x,
...,
round_digits = drift_dm_default_rounding(),
print_rows = 10,
some = FALSE,
show_header = TRUE,
show_note = TRUE
)
object |
an object of type drift_dm or |
... |
additional arguments passed to the respective method. |
value |
numerical, a vector with valid values to update the model's parameters. Must match with the number of (unique and free) parameters. |
eval_model |
logical, indicating if the model should be re-evaluated or
not when updating the parameters (see re_evaluate_model).
Default is |
select_unique |
logical, indicating if only those parameters shall be
returned that are considered unique (e.g., when a parameter is set to be
identical across three conditions, then the parameter is only returned once).
Default is |
select_custom_prms |
logical, indicating if custom parameters shall be
returned as well. Only has an effect if |
x |
an object of type |
round_digits |
integer, controls the number of digits shown. Default is 3. |
print_rows |
integer, controls the number of rows shown. |
some |
logical. If |
show_header |
logical. If |
show_note |
logical. If |
coef()
are methods for the generic coef
function; coefs<-()
is a
generic replacement function, currently supporting objects of type
drift_dm.
The argument value
supplied to the coefs<-()
function must match with
the vector returned from coef(<object>)
. It is possible to
update just part of the (unique) parameters.
Whenever the argument select_unique = TRUE
, dRiftDM tries to provide
unique parameter labels.
For objects of type drift_dm, coefs()
returns either a named
numeric vector if select_unique = TRUE
, or a matrix if
select_unique = FALSE
. If select_custom_prms = TRUE
, custom parameters
are added to the matrix.
For objects of type fits_ids_dm
, coefs()
returns a data.frame. If
select_unique = TRUE
, the columns will be the (unique, free) parameters,
together with a column coding IDs
. If select_unique = FALSE
, the columns
will be the parameters as listed in the columns of prms_matrix
(see
drift_dm), together with columns coding the conditions and
IDs
. If select_custom_prms = TRUE
, the data.frame will also contain
columns for the custom parameters. The returned data.frame has the class
label coefs_dm
to easily plot histograms for each parameter
(see hist.coefs_dm).
drift_dm()
# get a pre-built model and a data set for demonstration purpose
# (when creating the model, set the discretization to reasonable values)
a_model <- dmc_dm(t_max = 1.5, dx = .0025, dt = .0025)
coef(a_model) # gives the free and unique parameters
coef(a_model, select_unique = FALSE) # gives the entire parameter matrix
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.