Skip to content

Observation-level random effects

9 messages · Shahinur, Islam, Thierry Onkelinx, David Duffy

#
Hello All,
I am having trouble with observation-level random effects while running the
full model investigating two fixed covariates (one categorical and one
continuous) and two random covariates (tank and family). While I am using
the only tank random effect, it works fine, but while I am adding another
random covariate (family), I am getting the error message: Error: number of
levels of each grouping factor must be < number of observations (problems:
family).

FYI, here is my code:
model1 <- lmer(development~ 1 +cross + egg +cross*egg + (1|Tank)+
(1|family) ,data=sp)

I do have different family IDs (n=108) for each row, I assume it creates
the problem.

Your suggestions will be much appreciated!

Regards,

Shahin

<><><><><><><><><><><><><><><><><><><><><><><><><><>

Shahinur S. Islam
PhD Candidate, Department of Ocean Sciences
Ocean Sciences Centre, Memorial University of Newfoundland
St. John's, NL  A1C 5S7, Canada
Cell: (+1)709-740-3324; Twitter: @EcoEvoGen
#
Dear Shanin,

You can't use an observation level random effect with a Gaussian
distribution.
Please provide the number of observations, number of unique families and
number of unique tanks.

Best regards,

Thierry

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 at 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 do 8 apr. 2021 om 17:08 schreef Shahinur, Islam <shahinur.islam at mun.ca>:

  
  
#
Hello All,

Thank you, Dr. Thierry, for the reply!

I am still having the problem!- just in case, I have attached my data
template.

When I am running the following code:
model1 <- lmer(development~ 1 +cross + egg +cross*egg + (1|Tank)+
(1|family) ,data=sp)

Still getting the errors: Error: number of levels of each grouping factor
must be < number of observations (problems: family).

Your suggestions will be much appreciated.

Regards,

Shahin

<><><><><><><><><><><><><><><><><><><><><><><><><><>

Shahinur S. Islam
PhD Candidate, Department of Ocean Sciences
Ocean Sciences Centre, Memorial University of Newfoundland
St. John's, NL  A1C 5S7, Canada
Cell: (+1)709-740-3324; Twitter: @EcoEvoGen


On Thu, Apr 8, 2021 at 1:35 PM Thierry Onkelinx <thierry.onkelinx at inbo.be>
wrote:
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: development.txt
URL: <https://stat.ethz.ch/pipermail/r-sig-mixed-models/attachments/20210408/c98794d7/attachment.txt>
#
Dear Shahin,

I assume that a1 to a20 are replicates of the same family "a". If that is
the case, you need to use the name of the family ("a") instead of the
replicate id's (a1 to a20). Currently, it looks like every observation has
a unique value for family. That would lead to an observation level random
effect, which you can't use with a Gaussian distribution as it confounds
with the residuals.

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 at 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 do 8 apr. 2021 om 18:50 schreef Shahinur, Islam <shahinur.islam at mun.ca>:

  
  
#
Hello Thierry,

No, they are not the replicates of the same family, but 20 different
families under Cross (Population) Farm.NA.

I am trying to see both Tank effect and family effect (possibly nested
within cross) separately, but it's giving me hard time with family.

Thank you for checking into this, and your suggestions will be much
appreciated!

Regards,

Shahin


On Fri., Apr. 9, 2021, 4:56 a.m. Thierry Onkelinx <thierry.onkelinx at inbo.be>
wrote:

  
  
#
If you can't group observations in a meaningful way into groups of
families, then you can't use the (group of) families as a random effect.

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 at 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 vr 9 apr. 2021 om 11:46 schreef Shahinur, Islam <shahinur.islam at mun.ca>:

  
  
2 days later
#
Dear Shahin. 
Thierry has already answered your question, in that unless you provide a within-family standard deviation for each 
"development.overall" or "egg.size" observation, there is no information about familial random effects. You can examine paternal 
and maternal contributions, since some of these are repeated across families (in your example data), 
but you will not have a lot of power, I fear.
#
Hello David,

Thank you for the reply (also thanks to Thierry).

You are right- I was trying to see paternal (Male.ID; 42 levels out of 103
observations) and maternal (Female.ID; 53 levels out of 103 observations)
contribution, but still getting boundary (singular) fit: see ?isSingular
errors  for development.overall or for some of the other traits (response
variables).

Thanks,

Shahin

<><><><><><><><><><><><><><><><><><><><><><><><><><>

Shahinur S. Islam
PhD Candidate, Department of Ocean Sciences
Ocean Sciences Centre, Memorial University of Newfoundland
St. John's, NL  A1C 5S7, Canada
Cell: (+1)709-740-3324; Twitter: @EcoEvoGen


On Mon, Apr 12, 2021 at 4:03 AM David Duffy <
David.Duffy at qimrberghofer.edu.au> wrote:

            

  
  
#
Dear Shahin. I have attempted to fit the "animal model" for "development", treating each observation as a single offspring, with egg and Tank as fixed effects (Tanks has 5 levels), and Cross as a RE. (These data are odd, with development falling on just 26 values, and Tank 5 has  20 obs at 895.3, and 2 x 901.1!). This was done in a couple of non-R genetics oriented LMM packages, incl Wombat (Karin Meyers' AI-REML package). This model still does not converge, but roughly Cross is 3/4 of the variance, and additive genetic ~1/4, with residual variance small (driven by repeated parents). You will have to seek local statistical advice re priors for a Bayesian model in, say, MCMCglmm, or augment your data with other datasets for this organism.