View source: R/baselineAdjustment.R
baselineAdjustment | R Documentation |
Create a new variable based on a time variable and a group variable where groups are constrained to be equal at specific timepoints.
baselineAdjustment(
object,
variable,
repetition,
constrain,
new.level = NULL,
collapse.time = NULL
)
object |
[data.frame] dataset |
variable |
[character] Column in the dataset to be constrained at specific timepoints. |
repetition |
[formula] Time and cluster structure, typically |
constrain |
[vector] Levels of the time variable at which the variable is constained. |
new.level |
[character or numeric] Level used at the constraint. If |
collapse.time |
[character] When not |
A vector of length the number of rows of the dataset.
data(ncgsL, package = "LMMstar")
## baseline adjustment 1
ncgsL$treat <- baselineAdjustment(ncgsL, variable = "group",
repetition= ~ visit|id, constrain = 1)
table(treat = ncgsL$treat, visit = ncgsL$visit, group = ncgsL$group)
ncgsL$treattime <- baselineAdjustment(ncgsL, variable = "group",
repetition= ~ visit|id, constrain = 1, collapse.time = ".")
table(treattime = ncgsL$treattime, visit = ncgsL$visit, group = ncgsL$group)
## baseline adjustment 2
ncgsL$treat2 <- baselineAdjustment(ncgsL, variable = "group",
new.level = "baseline",
repetition= ~ visit|id, constrain = 1)
table(treat = ncgsL$treat2, visit = ncgsL$visit, group = ncgsL$group)
ncgsL$treattime2 <- baselineAdjustment(ncgsL, variable = "group",
new.level = "baseline",
repetition= ~ visit|id, constrain = 1, collapse.time = ".")
table(treattime = ncgsL$treattime2, visit = ncgsL$visit, group = ncgsL$group)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.