RiemannL2sim | R Documentation |
This class is created to set up a simulations scenario, simulate data from it, fit models, do cross-validation, predict quantities of interest, and summarize relevant statistics in an easy and transparent way.
The methods depend on the magrittr %>%
operator and dplyr::bind_rows
.
And, if messaging is desired, on the R-package telegram
.
model0
the underlying true model object.
newdata0_FDboost
the data used for sampling in FDboost format.
new_mf0
a clone of the mfGeometry of model0 with newdata0.
new_pred0_
predictions of model0 on newdata0.
sessionInfo
the result of sessionInfo() executed at initialization.
new_effect0
effects of model0 evaluated on newdata0.
new_fac0
tensor-product factorization of model0 on newdata0.
seed
the random seed used for the simulation.
n
a vecor of length three of the form c(n_sim = NA, n_obj = NA, n_grid = NA) containing the specified (average) sample sizes.
simdata
the simulated dataset.
cluster
the cluster id used for parallel computing.
family
the family object used.
mfboost_control
the list specified for controlling mboost in the model fits.
models
the fitted model objects.
runtime
the runtime of the model fits.
warnings
warnings produced during model fits.
cvrisk_control
a list of argument supplied to control the cross-validation.
cv_seeds
seeds used for cross-validation.
cvs
cross-validation objects.
runtime_cv
runtimes of the cross-validations.
warnings_cv
warnings produced during cross-validations.
preds_
predictions of model fits in internal geometry format.
poles_
poles predicted in internal geometry format.
effects
effects estimated on fitted models.
facs
factorized model fits.
simsum
first simulation summary.
bot
TGbot object of R package telegram used for automized notifications.
name
name of the simulation.
new()
initialize simulation scenario.
RiemannL2sim$new(model0, newdata0 = NULL, name = NULL)
model0
the model object with the underlying truth.
newdata0
new data to simulate from. The default
NULL
will take the data of model0
.
name
character string, a name for the simulation scenario.
gridsampler()
function sampling from the evaluations of a single response observation
RiemannL2sim$gridsampler(x, size)
x
vector to be subsampled from
size
average sample size
sample_topdown()
function for sampling observations
RiemannL2sim$sample_topdown( n_sim = 1, n_obj = 1, n_grid = 40, seed = NULL, sample_obj = sample, sample_grid = self$gridsampler )
n_sim, n_obj, n_grid
sample sizes
seed
random seed
sample_obj
function to sample from objects.
sample_grid
function to sample within objects.
sample_blockwise()
function for sampling observations in a blockwise strategy to preserve covariate composition.
RiemannL2sim$sample_blockwise( n_sim = 1, n_blocks = 1, n_grid = 40, seed = NULL, random_trafo = function(y_) y_, sample_grid = self$gridsampler )
n_sim, n_grid
sample sizes.
n_blocks
number of blocks in each sample.
seed
random seed. For the defaul NULL
, the seed
is randomly drawn.
random_trafo
function taking y_
an returning it
after random transformations.
sample_grid
function to sample within objects.
parallel_setup()
initialize parallel computing
RiemannL2sim$parallel_setup(nc = detectCores())
nc
number of cores.
parallel_stop()
end parallel computing
RiemannL2sim$parallel_stop()
fit()
fit simulated datasets
RiemannL2sim$fit(family = self$model0$family, ..., verbose = FALSE)
family
mfFamily object used for fitting.
...
arguments supplied to mboost control argument.
verbose
logical, should live info be printed.
crossvalidate()
conduct cross-validations of fitted models.
RiemannL2sim$crossvalidate( type = "kfold", B = 5, ..., verbose = FALSE, seeds = NULL )
type
type of resampling (as for mboost).
B
number of resampling folds.
...
other arguments supplied to cvLong.
verbose
logical, should live info be printed?
seeds
vector of random seeds for cross-validation. For the
default NULL
, seeds are randomly drawn.
predict()
predict model0 and models and extract estimated effects.
RiemannL2sim$predict()
summarize()
generate simulation summary
RiemannL2sim$summarize()
notify()
send automated notifications via telegram using the R package telegram. For getting started see their package vignette.
RiemannL2sim$notify(token = bot_token("RBot"), id = user_id("me"), name = NULL)
token
telegram bot token, see ?telegram::bot_token
.
id
telegram user id, see ?telegram::user_id
.
name
simulation name attached to the notification.
plot()
make first summary for first inspection of results.
RiemannL2sim$plot()
clone()
The objects of this class are cloneable with this method.
RiemannL2sim$clone(deep = FALSE)
deep
Whether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.