ranblock

0th

Percentile

Randomized Block Mixed Linear Model

Fits a mixed linear model by REML. The linear model must contain only one random factor apart from the unit errors.

Keywords
regression
Usage
randomizedBlock(formula, random, weights=NULL, fixed.estimates=TRUE, data=list(), subset=NULL, contrasts=NULL)
randomizedBlockFit(y,X,Z,w=NULL,fixed.estimates=TRUE)
Arguments
formula
formula specifying the fixed model.
random
vector or factor specifying the blocks corresponding to random effects.
weights
optional vector of prior weights.
fixed.estimates
should the fixed effect coefficients be returned?
data
an optional data frame containing the variables in the model.
subset
an optional vector specifying a subset of observations to be used in the fitting process.
contrasts
an optional list. See the contrasts.arg of model.matrix.default.
y
response vector.
X
design matrix for fixed model.
Z
design matrix for random effects.
w
optional vector of prior weights.
Details

This function fits the model $y=Xb+Zu+e$ where $b$ is a vector of fixed coefficients and $u$ is a vector of random effects. Write $n$ for the length of $y$ and $q$ for the length of $u$. The random effect vector $u$ is assumed to be normal, mean zero, with covariance matrix $\sigma^2_uI_q$ while $e$ is normal, mean zero, with covariance matrix $\sigma^2I_n$. If $Z$ is an indicator matrix, then this model corresponds to a randomized block experiment. The model is fitted using an eigenvalue decomposition which transforms the problem into a Gamma generalized linear model. This function is essentially equivalent to lme(fixed=formula,random=~1|random) but is more accurate and is much faster for small to moderate size data sets. Missing values in the data are not allowed.

Value

  • A list with the components. If fixed.estimates=TRUE then the components from "lm.fit" are also returned.
  • sigmasquaredvector of length two containing the residual and block components of variance.
  • se.sigmasquaredstandard errors for the components of variance.

See Also

lme, lm, lm.fit

Aliases
  • randomizedBlock
  • randomizedBlockFit
Examples
#  Compare with first data example from Venable and Ripley (2002), Chapter 10, "Linear Models"
library(MASS)
data(petrol)
out <- randomizedBlock(Y~SG+VP+V10+EP, random=No, data=petrol)
cbind(sigmasquared=out$sigmasquared,se=out$se.sigmasquared)
Documentation reproduced from package statmod, version 0.6, License: GPL version 2 or newer

Community examples

Looks like there are no examples yet.