data(salamander)
salamander$mixed<-with(salamander, Cross=="W/R" | Cross=="R/W")
salamander$RWvsWR<-with(salamander, ifelse(mixed,
((Cross=="R/W")-(Cross=="W/R"))/2,
0))
xsalamander<-xdesign(id=list(~Male, ~Female), data=salamander,
overlap="unbiased")
## Adjacency matrix
## Blocks 1 and 2 are actually the same salamanders, but
## it's traditional to pretend they are independent.
image(xsalamander$adjacency)
## R doesn't allow family=binomial(identity)
success <- svyglm(Mate~mixed+RWvsWR, design=xsalamander,
family=quasi(link="identity", variance="mu(1-mu)"))
summary(success)
Run the code above in your browser using DataLab