n.groups <- 3 n.sample <- 10 n <- n.groups* n.sample x <- rep(1:n.groups, rep(n.sample, n.groups)) pop <- factor(x, labels = c("Montpellier","Paris","Leon")) shrub.M <- sort(runif(n.sample,0,1)) shrub.P <- sort(runif(n.sample,0,1)) shrub.L <- sort(runif(n.sample,0,1)) shrub <- c(shrub.M,shrub.P,shrub.L) N <- round(runif(n,10,50)) Xmat <- model.matrix(~pop*shrub) #print(Xmat,dig=2) beta.vec <- c(-4,1,2,1,2,6) lin.pred <- Xmat[,]%*%beta.vec exp.p <- exp(lin.pred)/(1+exp(lin.pred)) C <- rbinom(n=n, size=N, prob=exp.p) rodents <- as.data.frame(cbind(shrub,C,N,pop)) rodents$pop <- factor(rodents$pop) levels(rodents$pop) <- c("Montpellier","Paris","Leon") #### Do not chage anything above this line ####### Data for students ######## # C == location with capture # N == total number of locations rodents