swap_treatment: Swap Treatment

Description Usage Arguments Value Author(s) Examples

View source: R/MinMSET.R

Description

Scrambles the elements of the vector and swaps a predefined number of elements. Afterwards, the vector is ordered according to the original ordering and returned.

Usage

1
2
3
swap_treatment(current_treatment,
               change,
               prev_index_list = NULL)

Arguments

current_treatment

a treatment vector to be changed.

change

number of elements that will be changed in the treatment vector.

prev_index_list

index list of the elements that can be changed. The current treatment vector may belong to a previous, unchangeable assignment.

Value

Returns a new treatment vector.

Author(s)

Sebastian Schneider sschneider@coll.mpg.de; sebastian@sebastianschneider.eu, Giulia Baldini giulia.baldini@uni-bonn.de

Examples

1
2
3
4
5
6
swap_treatment(current_treatment = c(0, 2, 0, 1, 1, 0, 2, 1, 1, 0),
                     change = 2)

swap_treatment(current_treatment = c(0, 2, 0, 1, 1, 0, 2, 1, 1, 0),
                     change = 2,
                     prev_index_list = c(1, 2, 3, 4))

minMSE documentation built on April 23, 2020, 5:06 p.m.