R/lc.median.ws.R

Defines functions ci.lc.median.ws

Documented in ci.lc.median.ws

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

ci.lc.median.ws <- function(alpha, m, h, V) {
# Computes a confidence interval for a linear function
# of within-subject medians
# Args:
#   alpha: alpha value for 1-alpha confidence
#   m: rx1 vector of sample medians for within-subject conditions
#   h: rx1 vector coefficients of linear function
#   V: rxr covariance matrix of within-subject sample medians
# Values:
#   estimate of linear function, SE of linear function, lower limit, upper limit
z <- qnorm(1 - alpha/2)
est <- t(h)%*%m
se <- sqrt(t(h)%*%V%*%h)
ll <- est - z*se
ul <- est + z*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:35 p.m.