swap_treatment.optim: Swap Treatment (using optim)

View source: R/MinMSET.R

swap_treatment.optimR Documentation

Swap Treatment (using optim)

Description

This function calls swap_treatment, but since optim requires fn and gr to have the same parameters, it has an additional one.

Usage

swap_treatment.optim(current_treatment,
                     data = NULL,
                     evaluation_function = NULL,
                     swap_treatment_function = swap_treatment,
                     mse_weights = NULL,
                     change,
                     prev_index_list = NULL)

Arguments

current_treatment

a treatment vector to be changed.

data

the parameter is only needed for optim, it does not play any role.

evaluation_function

the parameter is only needed for optim, it does not play any role.

swap_treatment_function

the function used to create new treatments. Default is swap_treatment. Other options are swap_treatment_prev which, given a previous treatment, creates a new treatment assignment that takes the previous one into account.

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.

mse_weights

the parameter is only needed for optim, it does not play any role.

Value

Returns a new treatment vector.

Author(s)

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

See Also

optim

Examples

swap_treatment.optim(current_treatment = c(0, 2, 0, 1, 1, 0, 2, 1, 1, 0),
                     change = 2)

swap_treatment.optim(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 March 18, 2022, 8:05 p.m.