fit_preference: Fit the Preference Data Collected from a Two-stage Clinical...

Description Usage Arguments Examples

View source: R/analyze-preference-data.r

Description

Computes the test statistics and p-values for the preference, selection, and treatment effects for the two-stage randomized trial using collected outcome, random, treatment, and strata values for specified significance level.

Usage

1
fit_preference(outcome, arm, treatment, strata, alpha = 0.05)

Arguments

outcome

(numeric) individual trial outcomes.

arm

(character or factor) a vector of "choice" and "random" character or factor values indicating the arm of the sample?

treatment

(character, factor, or integer) which treatment an individual received

strata

(optional integer) which strata the individual belongs to.

alpha

(optional numeric) Level of significance (default=0.05)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Unstratified
outcome <- c(10, 8, 6, 10, 5, 8, 7, 6, 10, 12, 11, 6, 8, 10, 5, 7, 9, 
             12, 6, 8, 9, 10, 7, 8,11)
arm <- c(rep("choice", 13), rep("random", 12))
treatment <- c(rep(1, 5), rep(2, 8), rep(1, 6), rep(2, 6))
fit_preference(outcome, arm, treatment)

# Stratified
# Same data plus strata information.
strata <- c(1,1,2,2,2,1,1,1,1,2,2,2,2,1,1,1,2,2,2,1,1,1,2,2,2)
fit_preference(outcome, arm, treatment, strata, alpha=0.1)

kaneplusplus/preference documentation built on Sept. 12, 2020, 12:37 p.m.