w.stat: Williams' Type Test Statistic.

Description Usage Arguments Details Value Note Examples

View source: R/test.stat.r

Description

Calculates a Williams' type test statistic for a constrained linear mixed effects model.

Williams' type statistic (individual)

Usage

1
2
3
w.stat(theta, cov.theta, B, A, ...)

w.stat.ind(theta, cov.theta, B, A, ...)

Arguments

theta

estimated coefficients.

cov.theta

covariance matrix of the (unconstrained) coefficients.

B

matrix to obtain the global contrast.

A

matrix of linear constraints.

...

additional arguments, to enable custom test statistic functions.

Details

See create.constraints for an example of A. Argument B is similar, but defines the global contrast for a Williams' type test statistic. This is the largest hypothesized difference in the constrained coefficients. So for an increasing simple order, the test statistic is the difference between the two extreme coefficients, theta_1 and theta_p1, divided by the standard error (unconstrained). For an umbrella order order, two contrasts are considered, theta_1 to theta_s, and theta_p1 to theta_s, each divided by the appropriate unconstrained standard error. A general way to express this statistic is:

W = max theta_{B[i,2]} - theta_{B[i,1]} / sqrt( VAR( theta_{B[i,2]} - theta_{B[i,1]} ) )

where the numerator is the difference in the constrained estimates, and the standard error in the denominator is based on the covariance matrix of the unconstrained estimates.

The function w.stat.ind does the same, but uses the A matrix which defines all of the individual constraints, and returns a test statistic for each constraints instead of taking the maximum.

Value

Output is a numeric value.

Note

See lrt.stat for information on creating custom test statistics.

Examples

1
2
3
4
5
6
7
8
9
theta  <- exp(1:4/4)
th.cov <- diag(4)
X1     <- matrix( 0 , nrow=1 , ncol=4 )
const  <- create.constraints( P1=4 , constraints=list(order='simple' ,
                                                    decreasing=FALSE) )

w.stat( theta , th.cov , const$B , const$A )

w.stat.ind( theta , th.cov , const$B , const$A )

jelsema/CLME documentation built on Aug. 20, 2017, 10:49 a.m.