w.stat {CLME} | R Documentation |
Williams' Type Test Statistic.
Description
Calculates a Williams' type test statistic for a constrained linear mixed effects model.
Usage
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_{p_1}
, divided by the standard error (unconstrained). For an umbrella order order, two contrasts are considered, \theta_1
to \theta_{s}
, and \theta_{p_1}
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
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 )