Learn R Programming

EMA (version 1.4.3)

test.nested.model: Test for nested ANOVA models

Description

The function compute the F-statistic for nested ANOVA model.

Usage

test.nested.model(X, X0, Y)

Arguments

X
this is the design matrix corresponding to the full model. X must be of full rank.
X0
this is the design matrix corresponding to the sub-model. X0 is such that span(X0) is a vectorial subspace of span(X). X0 must be of full rank.
Y
this is a matrix corresponding to the dependent variable (samples in row, variables (e.g. genes) in column.

Value

  • A list with the following items:
  • thetaThe estimation of the paratemer of the full model.
  • FValue of the F-statistic.
  • pvalueThe p-value.
  • residualsThe residuals for the full model.
  • sigma2The estimation of the variance for the full model.
  • XThe matrix design X

Details

The F-statistic is computed and the p-value is returned. The F-statistic has r-r0 and n-r degrees of freedom where r is the rank of matrix X, r0 is the rand of matrix X0 and n is the number of observations.

Examples

Run this code
Y <- matrix(rnorm(21), 21, 1)
ef <- gl(3,7)
X <- lm(Y ~ ef, x = TRUE)$x
X0 <- lm(Y ~ 1, x = TRUE)$x

res.test <- test.nested.model(X, X0, Y)

Run the code above in your browser using DataLab