add_obs_data: Randomize and calculate observed outcome

View source: R/gen_blocked_data.R

add_obs_dataR Documentation

Randomize and calculate observed outcome

Description

Given a passed potential outcomes schedule, randomize within block and generate observed potential outcomes and add them to the schedule.

Usage

add_obs_data(dat, p = 0.5, Y0 = "Y0", Y1 = "Y1", blockvar = "B")

Arguments

dat

Dataframe with a named Y0, Y1, and block column

p

Proportion of units treated. Can be vector and will treat that proportion in each block, rounded to nearest and with at least 1 treatment and control unit.

Y0

name of Y0 column

Y1

name of Y1 column

blockvar

name of blocking column. This column will be converted to a factor, if it is not already, and the order of p corresponds to the levels of this factor.

Value

augmented 'dat' with Z and Yobs columns


lmiratrix/blkvar documentation built on Nov. 18, 2024, 1:27 p.m.