Learn R Programming

carts (version 0.1.0)

trial.estimates-class: trial.estimates class object

Description

Trial$run() returns an S3 class object trial.estimates. The object contains all information to reproduce the estimates as shown in the example. The object is a list with the following components:

model

Trial object used to generate the estimates.

estimates

(list) Estimates of Monte-Carlo runs for each of the estimators.

sample.data

(data.table) Sample data returned from Trial$simulate().

estimators

(list) Estimators applied to simulated data in each Monte-Carlo run.

sim.args

(list) Arguments passed on to Trial$simulate() when simulating data in each Monte-Carlo run.

R

(numeric) Number of Monte-Carlo replications.

Arguments

S3 generics

The following S3 generic functions are available for an object of class trial.estimates:

print

Basic print method.

Examples

Run this code
trial <- Trial$new(
  covariates = function(n) data.frame(a = rbinom(n, 1, 0.5)),
  outcome = function(data) rnorm(nrow(data), data$a * -1)
 )
res <- trial$run(n = 100, R = 10, estimators = est_glm())
print(res)

# assuming previous estimates have been saved to disk.
# load estimates object and repeat simulation with more Monte-Carlo runs
res2 <- do.call(
  res$model$run,
  c(list(R = 20, estimators = res$estimators), res$sim.args)
)
print(res2)

Run the code above in your browser using DataLab