[R-sig-ME] pairwise combinations of subjects

Noelle G. Beckman beckm089 @end|ng |rom umn@edu
Tue Jul 16 14:47:09 CEST 2019


I am currently out of the office until July 5th. I will respond to your email upon my return.

On Jul 16, 2019, at 1:35 AM, Thierry Onkelinx via R-sig-mixed-models <r-sig-mixed-models using r-project.org> wrote:

> Dear Hank,
> 
> Here is a solution using the INLA package. This model has two random
> effects with identical estimates for each level.
> 
> # make sure that sp1 contains each level
> old <- x$sp1[n - 1]
> x$sp1[n - 1] <- x$sp2[n - 1]
> x$sp2[n - 1] <- old
> 
> # fit the model
> library(INLA)
> m <- inla(y ~ c + f(sp1, model = "iid", n = n) + f(sp2, copy = "sp1"), data
> = x)
> summary(m)
> plot(m)
> 
> Best regards,
> 
> 
> ir. Thierry Onkelinx
> Statisticus / Statistician
> 
> Vlaamse Overheid / Government of Flanders
> INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE AND
> FOREST
> Team Biometrie & Kwaliteitszorg / Team Biometrics & Quality Assurance
> thierry.onkelinx using inbo.be
> Havenlaan 88 bus 73, 1000 Brussel
> www.inbo.be
> 
> ///////////////////////////////////////////////////////////////////////////////////////////
> To call in the statistician after the experiment is done may be no more
> than asking him to perform a post-mortem examination: he may be able to say
> what the experiment died of. ~ Sir Ronald Aylmer Fisher
> The plural of anecdote is not data. ~ Roger Brinner
> The combination of some data and an aching desire for an answer does not
> ensure that a reasonable answer can be extracted from a given body of data.
> ~ John Tukey
> ///////////////////////////////////////////////////////////////////////////////////////////
> 
> <https://www.inbo.be>
> 
> 
> Op ma 15 jul. 2019 om 15:33 schreef Stevens, Hank <hank.stevens using miamioh.edu
> :
> 
> I was hoping someone might point to information or examples of this type of
> problem.
> 
> I sometimes encounter data that are derived from interactions between all
> pairwise interactions of subjects (e.g., subject a vs. subject b, subject a
> vs. subject c, subject b vs. subject c). The response is the result of the
> interaction between subjects, and observations are likely to show
> correlations within subject. We are interested in the relation between a
> fixed effect predictor and the response, and not the effects of subject per
> se. For instance,
> 
> subj_1   subj_2 . pred  resp
>  a        b       1      5
>  a        c       1.1 .  4
>  b        c       2.5 .  1
> 
> where the subj 1 and subj 2 are all the same individuals, but are paired
> with a different partner. It seems as though this might be crossed random
> effects of subj_1 and subj_2. E.g.,
> lmer( resp ~ pred + (1|subj1) + (1|subj2) )
> 
> This seems like a design that might be common in breeding....
> 
> Many thanks for your thoughts and leads.
> 
> Hank Stevens
> 
> A more thorough worked example:
> 
> library(lme4)
> df <- expand.grid(gl())
> n <- 5
> l <- n*(n-1)/2
> x <- data.frame( matrix(NA, nr=1, nc=2) )
> names(x) <- c("sp1", "sp2")
> 
> r <- 1
> for(i in 1:(n-1)){
>  for(j in (i+1):n){
>    x[r,1:2] <- c(i,j)
>    r <- r+1
>  }
> }
> 
> set.seed(4)
> x$y <- (x$sp1 + x$sp2) / (n*2) + runif(l)
> set.seed(3)
> x$c <- - (x$sp1 + x$sp2) / (n*2) + runif(l)
> 
> ## which design, if any?
> summary( lm(y ~ c, data=x))
> summary( lmer(y ~ c + (1|sp1) + (1|sp2), data=x))
> 
> --
> *Dr. Hank Stevens*
> Lab website <http://blogs.miamioh.edu/stevens-lab/>
> PhD Program in Ecology, Evolution, and Environmental Biology
> <http://www.cas.muohio.edu/eeeb/index.html>
> 433 Hughes Hall, Miami University, tel: 513-529-4206
> 
>        [[alternative HTML version deleted]]
> 
> _______________________________________________
> R-sig-mixed-models using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
> 
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-sig-mixed-models using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

	[[alternative text/enriched version deleted]]



More information about the R-sig-mixed-models mailing list