R/lc.median.bs.R

Defines functions ci.lc.median.bs

Documented in ci.lc.median.bs

# DGB
## Linear Contrast of Medians (Between Subjects)

ci.lc.median.bs <- function(alpha, m, se, v) {
 # Computes a confidence interval for a linear contrast of medians
 # in a between-subjects design using sample medians and
 # their standard errors (the sample median and standard error
 # for each group can be obtained from the ci.median.os function). 
 # Arguments:
 #   alpha:    alpha level for 1-alpha confidence
 #   m:        vector of sample medians
 #   se:       vector of standard errors
 #   v:        vector of contrast coefficients
 # Values:
 #   estimate of linear contrast, SE of linear contrast, lower limit, upper limit
 est <- t(v)%*%m
 se <- sqrt(t(v)%*%diag(se^2)%*%v)
 zcrit <- qnorm(1 - alpha/2)
 ll <- est - zcrit*se
 ul <- est + zcrit*se
 out <- t(c(est, se, ll, ul))
 colnames(out) <- c("Estimate", "SE", "LL", "UL")
 return(out)
}
cwendorf/DGB documentation built on May 3, 2022, 9:34 p.m.