Last data update: 2014.03.03

R: Design Matrices for Multiple Membership Models
mult.membR Documentation

Design Matrices for Multiple Membership Models

Description

Forms design matrices for multiple membership models

Usage

mult.memb(formula)

Arguments

formula

formula

Details

Currently mult.memb can only usefully be used inside an idv variance function. The formula usually contains serveral factors that have the same factor levels.

Value

design matrix

Author(s)

Jarrod Hadfield j.hadfield@ed.ac.uk

Examples

fac1<-factor(sample(letters[1:3], 5, TRUE), levels=letters[1:3])
fac2<-factor(sample(letters[1:3], 5, TRUE), levels=letters[1:3])
cbind(fac1, fac2)
mult.memb(~fac1+fac2)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(MCMCglmm)
Loading required package: Matrix
Loading required package: coda
Loading required package: ape
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/MCMCglmm/mult.memb.Rd_%03d_medium.png", width=480, height=480)
> ### Name: mult.memb
> ### Title: Design Matrices for Multiple Membership Models
> ### Aliases: mult.memb
> ### Keywords: manip
> 
> ### ** Examples
> 
> fac1<-factor(sample(letters[1:3], 5, TRUE), levels=letters[1:3])
> fac2<-factor(sample(letters[1:3], 5, TRUE), levels=letters[1:3])
> cbind(fac1, fac2)
     fac1 fac2
[1,]    2    1
[2,]    2    2
[3,]    2    3
[4,]    2    1
[5,]    1    1
> mult.memb(~fac1+fac2)
  fac1a fac1b fac1c
1     1     1     0
2     0     2     0
3     0     1     1
4     1     1     0
5     2     0     0
attr(,"assign")
[1] 1 1 1
attr(,"contrasts")
attr(,"contrasts")$fac1
[1] "contr.treatment"

> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>