lm | R Documentation |
lm()
When you create R6 object "RCTtoolbox"
via create_RCTtoolbox
and run its method lm()
,
the method internally implements a function
that fit linear model by least squares.
The method lm()
provides some arguments.
See the section "Arguments."
ctrl |
character. New control arm.
If NULL (default),
the first element of |
subset |
subset condition.
If NULL (default),
full observations of |
weights |
weight variable for weighted least squares. If NULL (default), implement ordinary least squares. |
cluster |
cluster variable for clustered standard error. If NULL (default), standard error is not clustered. |
only_dmod |
logical (default is TRUE). Whether to estimate linear model without covariates? |
... |
arguments passed to |
R6 object with "RCTtoolbox.balance.test" class. The returned object has following field and methods:
result
Field.
List of estimated result ("lm_robust" class).
See lm_robust
for each element of list.
print()
Method.
Print information about the returned object.
Run $print()
.
summary()
Method.
Print result in console.
Run $summary()
.
table()
Method.
Create output table of estimation result.
Run $table()
.
A method lm()
provided by R6 object RCTtoolbox
implements RCTtoolbox.lm$new()
which generates R6 object with "RCTtoolbox.lm" class.
Initialization of R6 object "RCTtoolbox.lm" does two things.
First, the private field dvec
of R6 object "RCTtoolbox" is
stored in the private field dvar
of returned object.
Second, run rct_lm(private$formula.yd, private$formula.x,
self$data, private$dvec.levels, private$dvec.labels, ...)
where ...
accepts arguments explained in the section "Arguments."
The first five arguments passed to rct_lm()
are
baseline
list of two-sided formula outcome ~ treat
.
The method ttest()
automatically
passes the private field formula.yd
of R6 object "RCTtoolbox"
to this argument.
covariate
list of one-sided formula ~ var1 + var2
The method lm()
automatically
passes the private field formula.x
of R6 object "RCTtoolbox"
to this argument.
data
data.frame/tibble object that you want to use.
The method ttest()
automatically
passes a public field data
of R6 object "RCTtoolbox"
to this argument.
treat_levels
character vector. Level of experimental arms.
The first element is control arm.
The method ttest()
automatically
passes the private field dvec.levels
of R6 object "RCTtoolbox"
to this argument.
treat_labels
character vector. Label of experimental arms
corresponding to treat_levels
.
The method ttest()
automatically
passes the private field dvec.labels
of R6 object "RCTtoolbox"
to this argument.
## Not run: data(RubellaNudge) rct <- create_RCTtoolbox( atest + avacc ~ treat, ~ age + educ, RubellaNudge, LETTERS[1:7] ) # estimate linear model rct$lm()$summary() ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.