update | R Documentation |
The update
function provides a unified interface for refreshing or modifying
existing analysis objects produced by the Qval package, including CDM
,
validation
, sim.data
and fit
classes. By passing additional arguments,
users can rerun fitting or simulation routines without reconstructing the entire object
from scratch.
update(x, ...)
## S3 method for class 'CDM'
update(x, ...)
## S3 method for class 'validation'
update(x, ...)
## S3 method for class 'sim.data'
update(x, ...)
## S3 method for class 'fit'
update(x, ...)
x |
An object of class |
... |
Additional arguments specific to the method being updated:
|
The update
methods internally extract the original call arguments
from the input object, combine them with any new parameters provided in
...
, and re-invoke the corresponding constructor (CDM
,
validation
, sim.data
and fit
).
This approach ensures consistency and preserves all untouched settings from the original object.
An updated object of the same class as x
, reflecting any changes
in the supplied parameters.
update(CDM)
: Update method for CDM objects
update(validation)
: Update method for validation objects
update(sim.data)
: Update method for sim.data objects
update(fit)
: Update method for fit objects
set.seed(123)
library(Qval)
################################################################
# Example 1: summary a CDM object #
################################################################
Q <- sim.Q(3, 20)
IQ <- list(P0 = runif(20, 0, 0.2), P1 = runif(20, 0.8, 1))
data.obj <- sim.data(Q, N = 500, IQ = IQ,
model = "GDINA", distribute = "horder")
CDM.obj <- CDM(data.obj$dat, Q, model = "GDINA", method = "BM")
summary(CDM.obj)
CDM.updated <- update(CDM.obj, method = "EM", maxitr = 1000)
summary(CDM.updated)
################################################################
# Example 2: summary a validation object #
################################################################
MQ <- sim.MQ(Q, 0.1)
CDM.obj2 <- CDM(data.obj$dat, MQ)
validation.obj <- validation(data.obj$dat, MQ, CDM.obj2,
method = "GDI")
summary(validation.obj)
validation.updated <- update(validation.obj, method = "Hull")
summary(validation.updated)
################################################################
# Example 3: summary a sim.data object #
################################################################
data.obj2 <- sim.data(Q = sim.Q(3, 10), N = 1000)
summary(data.obj2)
data.updated <- update(data.obj2, N = 200)
summary(data.updated)
################################################################
# Example 4: summary a fit object #
################################################################
fit.obj <- fit(data.obj$dat, Q, model = "GDINA")
summary(fit.obj)
data.updated <- update(fit.obj, model = "DINA")
summary(data.updated)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.