RCT_predict: RCT Predict

Description Usage Arguments Value Examples

View source: R/rct-predict.R

Description

RCT_predict perform additional analysis on model returned by cv_model function assuming RCT data

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
RCT_predict(
  model,
  new_data,
  outcome,
  group,
  control_label,
  treatment_label,
  subject_label = rownames(new_data),
  na.rm = FALSE
)

Arguments

model

Object returned by cv_model function

new_data

Data frame

outcome

Character string indicating the outcome column in new_data

group

Character vector indicating the name of the column in data where group information is stored

control_label

Character vector indicating the label inside the group column for the control group

treatment_label

Character vector indicating the label inside the group column for the treatment group

subject_label

Row labels, usually participants names. Default is new_data row names

na.rm

Should NAs be removed? Default is FALSE

Value

Object of class bmbstats_RCT_predict

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
data("vertical_jump_data")

m1 <- cv_model(
  `Post-test` ~ `Pre-test` + Group,
  vertical_jump_data,
  control = model_control(
    cv_repeats = 10,
    cv_folds = 3,
    cv_strata = vertical_jump_data$Group
  )
)

m1_rct <- RCT_predict(
  m1,
  new_data = vertical_jump_data,
  outcome = "Post-test",
  group = "Group",
  treatment_label = "Treatment",
  control_label = "Control"
)

m1_rct
plot(m1_rct)

mladenjovanovic/bmbstats documentation built on Aug. 5, 2020, 4:20 p.m.