bothsidesmodel.df: Obtain the degrees of freedom for a model.

View source: R/bothsidesmodel.df.R

bothsidesmodel.dfR Documentation

Obtain the degrees of freedom for a model.

Description

Determines the denominators needed to calculate an unbiased estimator of \Sigma_R.

Usage

bothsidesmodel.df(xx, n, pattern)

Arguments

xx

Result of (X^T * X), where T denotes tranpose.

n

Number of rows in observation matrix given

pattern

An N \times P matrix of 0's and 1's indicating which elements of \beta are allowed to be nonzero.

Value

A numeric matrix of size N \times N containing the degrees of freedom for the test.

See Also

bothsidesmodel, bothsidesmodel.chisquare, bothsidesmodel.hotelling, bothsidesmodel.lrt, and bothsidesmodel.mle.

Examples

# Find the DF for a likelihood ratio test statistic.
x <- cbind(
  1, c(-2, -1, 0, 1, 2), c(2, -1, -2, -1, 2),
  c(-1, 2, 0, -2, 1), c(1, -4, 6, -4, 1)
)
# or x <- cbind(1, poly(1:5, 4))
data(skulls)
x <- kronecker(x, rep(1, 30))
y <- skulls[, 1:4]
z <- diag(4)
pattern <- rbind(c(1, 1, 1, 1), 1, 0, 0, 0)
xx <- t(x) %*% x
bothsidesmodel.df(xx, nrow(y), pattern)

coatless/msos documentation built on Nov. 16, 2023, 5:31 a.m.