[R-sig-ME] Testing significance of deviation of sex ratio (prop of females) from a priori predicted proportion
ONKELINX, Thierry
Thierry.ONKELINX at inbo.be
Mon Jan 20 12:36:09 CET 2014
Hi Tom,
Try
data$baseline <- qlogis(0.75)
fit <- glmer(cbind(females, males) ~ offset(baseline) + (1|colony), family = binomial(link=logit), data = data)
or send me a reproducible example.
Please keep the mailing list in cc.
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium
+ 32 2 525 02 51
+ 32 54 43 61 85
Thierry.Onkelinx op inbo.be
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
-----Oorspronkelijk bericht-----
Van: Tom Wenseleers [mailto:Tom.Wenseleers op bio.kuleuven.be]
Verzonden: maandag 20 januari 2014 10:37
Aan: ONKELINX, Thierry
Onderwerp: RE: [R-sig-ME] Testing significance of deviation of sex ratio (prop of females) from a priori predicted proportion
Hi Thierry,
One problem though I bump into:
library(devtools)
install_github("lme4",user="lme4")
library(lme4)
If I then try
fit=glmer(cbind(femalesmales) ~ offset(qlogis(0.75)) + (1|colony), family = binomial(link=logit), data = data) I get the error Error in model.frame.default(data = data, drop.unused.levels = TRUE, :
variable lengths differ (found for 'offset(qlogis(0.75))')
Any thoughts what I am doing wrong? What version of lme4 should I be using?
Cheers,
Tom
-----Original Message-----
From: ONKELINX, Thierry [mailto:Thierry.ONKELINX op inbo.be]
Sent: 20 January 2014 09:24
To: Tom Wenseleers; r-sig-mixed-models op r-project.org
Subject: RE: [R-sig-ME] Testing significance of deviation of sex ratio (prop of females) from a priori predicted proportion
Dear Tom,
I would add the null hypothesis as an offset. Then the intercept would be the deviation from that null hypothesis.
Fit <- glmer(cbind(females, males) ~ offset(qlogis(0.75)) + (1|colony), family = binomial, data = data)
library(multcomp)
confint(glht(Fit))
Addingspacesmakescodemuchmorereadable.
Best regards,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance Kliniekstraat 25
1070 Anderlecht
Belgium
+ 32 2 525 02 51
+ 32 54 43 61 85
Thierry.Onkelinx op inbo.be
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
-----Oorspronkelijk bericht-----
Van: r-sig-mixed-models-bounces op r-project.org [mailto:r-sig-mixed-models-bounces op r-project.org] Namens Tom Wenseleers
Verzonden: maandag 20 januari 2014 0:54
Aan: r-sig-mixed-models op r-project.org
Onderwerp: [R-sig-ME] Testing significance of deviation of sex ratio (prop of females) from a priori predicted proportion
Dear all,
I have counts of males and females produced by different colonies of a species of social insects.
I fitted the model
Fit=glmer(cbind(females,names)~1+(1|colony),family=binomial,data=data)
However, how can I test within such a framework if the overall average sex ratio deviates from an a priori predicted value (e.g. half females, or ¾ females)?
I presume this would have to be done based on the fitted intercept. But how does one do this? Also, what would be the best way to get 95% conf lims on the estimate? Using likelihood profiling, or parametric bootstrap? Does anybody happen to have any example calculation?
Cheers,
Tom
_______________________________________________________________________________________
Prof. Tom Wenseleers
* Lab. of Socioecology and Social Evolution
Dept. of Biology
Zoological Institute
K.U.Leuven
Naamsestraat 59, box 2466
B-3000 Leuven
Belgium
* +32 (0)16 32 39 64 / +32 (0)472 40 45 96
* tom.wenseleers op bio.kuleuven.be
http://bio.kuleuven.be/ento/wenseleers/twenseleers.htm
[[alternative HTML version deleted]]
* * * * * * * * * * * * * D I S C L A I M E R * * * * * * * * * * * * * Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is door een geldig ondertekend document.
The views expressed in this message and any annex are purely those of the writer and may not be regarded as stating an official position of INBO, as long as the message is not confirmed by a duly signed document.
* * * * * * * * * * * * * D I S C L A I M E R * * * * * * * * * * * * *
Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is door een geldig ondertekend document.
The views expressed in this message and any annex are purely those of the writer and may not be regarded as stating an official position of INBO, as long as the message is not confirmed by a duly signed document.
More information about the R-sig-mixed-models
mailing list