View source: R/ctEmpiricalBayesFit.R
| ctEmpiricalBayesFit | R Documentation |
Fits one ctsem model per subject using the model prior, estimates the empirical marginal distribution of the raw parameters, then fits each subject again using the resulting empirical Bayes prior.
ctEmpiricalBayesFit(
datalong,
model,
subjects = "all",
priors = TRUE,
optimize = TRUE,
cores = 2,
subjectFitArgs = list(),
Npasses = 2,
ebUse = c("rawest", "rawposterior"),
ebRobust = TRUE,
ebOutlierMAD = 6,
ebOutlierQuantiles = c(0.025, 0.975),
ebWinsorize = TRUE,
minsd = 1e-06,
verbose = 0,
progress = TRUE,
...
)
datalong |
Long format data containing multiple subjects. |
model |
Model object from |
subjects |
Vector of subject identifiers to fit, or |
priors |
Logical. Passed to |
optimize |
Logical. Passed to |
cores |
Number of subjects to fit in parallel. Each individual
subject-level |
subjectFitArgs |
Named list of additional arguments passed to each
|
Npasses |
Total number of subject-wise fitting passes. The default
|
ebUse |
|
ebRobust |
Logical. If TRUE, the empirical Bayes prior is built from robust raw summaries after outlier handling. |
ebOutlierMAD |
Positive numeric. Raw values farther than this
many MAD-scaled deviations from the median are treated as outliers. Use
|
ebOutlierQuantiles |
Length two numeric vector of lower and upper
quantiles used to bound first-pass raw values, or |
ebWinsorize |
Logical. If TRUE, outlying first-pass raw values are clamped to the outlier bounds before computing the EB prior. If FALSE, they are set to missing for EB prior construction. |
minsd |
Lower bound used for empirical raw SDs before model adjustment. |
verbose |
Integer from 0 to 2. Passed to |
progress |
Logical. If TRUE, report the current EB fitting stage and overwrite a single console line with the subject fitting percentage. |
... |
Additional arguments passed to each |
Object of class ctEmpiricalBayesFit, containing the subject
fit lists and metadata. $initialfits contains the first-pass model
prior fits, $fits contains the final empirical Bayes prior fits, and
$passfits contains every pass. Use summary() to compute final
transformed-parameter means, SDs, covariances, correlations, and outlier
diagnostics.
model <- ctModel(type='ct', manifestNames='Y1', LAMBDA=matrix(1))
eb <- ctEmpiricalBayesFit(ctstantestdat, model, cores=2,
subjectFitArgs=list(optimcontrol=list(finishsamples=20)))
summary(eb)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.