[R-sig-ME] Help with a mixed effects model
Thierry Onkelinx
th|erry@onke||nx @end|ng |rom |nbo@be
Thu Jun 18 09:06:09 CEST 2020
Dear Saudi,
Please keep the mailing list in cc.
It is best to convert the characters to factor. The response variable of a
binomial is most clear when it is either a logical (TRUE = success, FALSE =
failure) or a two column integer value (cbind(number of success, number of
failures)).
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 wo 17 jun. 2020 om 22:54 schreef Saudi Sadiq <saudisadiq using gmail.com>:
> Sorry for the mistake, and thanks for the reply.
> Here are the results of > str(sub_data)
> tibble [263 x 10] (S3: tbl_df/tbl/data.frame)
> $ part : chr [1:263] "Part1" "Part2" "Part3" "Part4" ...
> $ WF : chr [1:263] "SA" "SA" "SA" "SA" ...
> $ gender : chr [1:263] "male" "female" "female" "female" ...
> $ age : num [1:263] 37 28 44 16 33 20 26 50 40 49 ...
> $ education: chr [1:263] "postgrad" "postgrad" "postgrad" "seconadry or
> below" ...
> $ SA_hum : num [1:263] 10 8 9 4 2 8 9 5 10 7 ...
> $ EA_hum : num [1:263] 6 7 10 8 8 9 10 9 9 10 ...
> $ SA_cul : num [1:263] 7 8 9 5 1 8 9 4 10 9 ...
> $ EA_cul : num [1:263] 10 7 9 9 9 8 10 8 10 9 ...
> $ better : chr [1:263] "SA" "SA" "EA" "EA" ...
>
> Hope this is okay.
> Best
>
> On Wed, 17 Jun 2020 at 19:12, Thierry Onkelinx <thierry.onkelinx using inbo.be>
> wrote:
>
>> Dear Saudi,
>>
>> Your attachment got stripped from the mail. This is explained under the
>> general instructions at https://www.r-project.org/mail.html#instructions.
>>
>> The problem seems to be in the data. So post the data in a suitable
>> format. Or send us the output of `str(sub_data)`
>>
>> 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 wo 17 jun. 2020 om 16:14 schreef Saudi Sadiq <saudisadiq using gmail.com>:
>>
>>> Hope everyone is safe and sound. I appreciate your help a lot.
>>>
>>> I am evaluating two Arabic subtitles of a humorous English scene and
>>> asked
>>> 263 participants (part) to evaluate the two subtitles (named Standard
>>> Arabic, SA, and Egyptian Arabic, EA) via a questionnaire that asked them
>>> to
>>> rank the two subtitles in terms of how much each subtitle is
>>>
>>> 2) more humorous (hum),
>>>
>>> 5) closer to Egyptian culture (cul)
>>>
>>>
>>>
>>> The questionnaire contained two 1-10 linear scale questions regarding
>>> the 2
>>> points clarified, with 1 meaning the most humorous and closest to
>>> Egyptian
>>> culture, and 10 meaning the least humorous and furthest from Egyptian
>>> culture. Also, the questionnaire had a general multiple-choice question
>>> regarding which subtitle is better in general (better). General
>>> information
>>> about the participants were also collected concerning gender (categorical
>>> factor), age (numeric factor) and education (categorical factor).
>>>
>>> To rule out the effect of which subtitle was watched first, two versions
>>> of
>>> the questionnaire were relied on: one showing the ‘SA subtitle first’ and
>>> another showing the ‘EA subtitle first’. Nearly half the participants
>>> answered the first and nearly half answered the latter. The info
>>> regarding
>>> this is called WF (watched first).
>>>
>>> I am focusing on which social factor/s lead/s the participants to
>>> evaluate
>>> one of the two subtitles as generally better and which subtitle is more
>>> humorous and closer to Egyptian culture. Actually, I wanted better to be
>>> the only dependent factor and asking participants 'which subtitle is
>>> better?' could be enough, but I wanted to have detailed information of
>>> why
>>> a subtitle is better by asking participants specific questions (regarding
>>> which subtitle is more humorous and closer to Egyptian culture). Most of
>>> the time, the total of the hum + cul = better, but sometimes it is not
>>> (e.g. the sum for subtitle EA could be bigger than for SA, but the
>>> participant prefers SA in the better column).
>>>
>>> I thought that mixed effects analyses would clarify the picture and
>>> answer
>>> the research questions (which factor/s lead/s participants to favour a
>>> subtitle over another?) and, so, tried the lme4 package in R and ran
>>> many
>>> models but all the codes I have used are not working.
>>>
>>> I ran the following codes, which yielded Error messages, like:
>>>
>>> model1<- lmer (better ~ gender + age + education + WF + (1 | part),
>>> data=sub_data)
>>>
>>> Error: number of levels of each grouping factor must be < number of
>>> observations (problems: part)
>>>
>>>
>>>
>>> Model2 <- glmer (better ~ gender + age + education + WF + (1 | part),
>>> data
>>> = sub_data, family='binomial')
>>>
>>> Error in mkRespMod(fr, family = family) :
>>>
>>> response must be numeric or factor
>>>
>>>
>>>
>>> Model3 <- glmer (better ~ age + gender + education + WF + (1 | part),
>>> data
>>> = sub_data, family='binomial',
>>> control=glmerControl(optimizer=c("bobyqa")))
>>>
>>> Error in mkRespMod(fr, family = family) :
>>>
>>> response must be numeric or factor
>>>
>>>
>>>
>>> Why do the models crash? Does the problem lie in the random factor part
>>> (which
>>> is a code for participants)? Or is it something related to the mixed
>>> effects analysis?
>>>
>>> I hope I am not violating the rules here as I am attaching the dataset (
>>> sub_data) just in case someone would like to have a look at it.
>>>
>>> All the best
>>>
>>> --
>>> Saudi Sadiq,
>>>
>>> --
>>> Saudi Sadiq,
>>>
>>> Lecturer, Minia University, Egypt
>>>
>>> Academia <http://york.academia.edu/SaudiSadiq>, Reserachgate
>>> <https://www.researchgate.net/profile/Saudi_Sadiq>, Google Scholar
>>> <https://scholar.google.co.uk/citations?user=h0latzcAAAAJ&hl=en>,
>>> Publons
>>> <https://publons.com/researcher/2950905/saudi-sadiq/>
>>>
>>> Certified Translator by (Egyta) <https://www.egyta.com/>
>>>
>>> Associate Fellow of the Higher Education Academy, UK
>>> <https://www.heacademy.ac.uk/>
>>> _______________________________________________
>>> R-sig-mixed-models using r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>>>
>>
>
> --
> Saudi Sadiq,
>
> Lecturer, Minia University, Egypt
>
> Academia <http://york.academia.edu/SaudiSadiq>, Reserachgate
> <https://www.researchgate.net/profile/Saudi_Sadiq>, Google Scholar
> <https://scholar.google.co.uk/citations?user=h0latzcAAAAJ&hl=en>, Publons
> <https://publons.com/researcher/2950905/saudi-sadiq/>
>
> Certified Translator by (Egyta) <https://www.egyta.com/>
>
> Associate Fellow of the Higher Education Academy, UK
> <https://www.heacademy.ac.uk/>
>
[[alternative HTML version deleted]]
More information about the R-sig-mixed-models
mailing list