Learn R Programming

glmmBUGS (version 2.4.2)

getDesignMatrix: Computes a design matrix from factors and interactions

Description

Converts all factors and interactions to indicator variables, suitable for passing to WinBUGS.

Usage

getDesignMatrix(formula, data, effects = NULL)

Arguments

formula

A formula object specifying the fixed effects for the model

data

A data frame containing the covariates and factors for random effects

effects

A vector of character strings containing the grouping levels, from most general to most specific

Value

A matrix containing the covariates, the response(s), and the random effect factors. Also attributes

covariates

A list giving the covariates which apply at each level, suitable for passing to winBugsRaggedArray

response

A vector of character strings giving the responses

Details

The most populous level of a factor is made the baseline.

See Also

winBugsRaggedArray, glmmBUGS

Examples

Run this code
# NOT RUN {
library(nlme)
data(Muscle)
muscleDesign = getDesignMatrix(conc ~ length, data=Muscle, effects="Strip" )
attributes(muscleDesign)$covariates
attributes(muscleDesign)$response
# }

Run the code above in your browser using DataLab