[R] checkConv and as.data.frame.default problems in R
Saudi Sadiq
ss1272 at york.ac.uk
Wed Jul 1 16:40:48 CEST 2015
Hi All,
I have two datasets, vowels and qaaf, and both have 8 columns clarified as
follows:
1. convergence: DV (whether participants succeeded to use CA (Cairene
Arabic) or fail to do so; hence, they use MA (Minia Arabic)
2. speaker: 62 participants
3. lexical.item: as pronounced
4. style: careful and casual
5. gender: males and females
6. age: continues variable
7. residence: urbanite, migrant to town or villager
8. education: secondary or below, university or postgraduate
The only difference between the two datasets is the number of items. With
the vowels dataset, there are 1339 items; in the qaaf dataset there are
4064 items.
The aim of the test done was to know which independent variable is more
responsible for using CA forms. I used the lme4 package, function glmer.
I ran the model:
1. modelvowels <- glmer(convergence ~ gender + age + residence +
education + style+ (1|lexical.item) + (1|speaker), data=vowels,
family='binomial')
The message came on the screen:
2. Warning message:
In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
Model failed to converge with max|grad| = 0.00210845 (tol = 0.001,
component 1)
Then I ran the model after removing STYLE as follows:
3. modelvowels <- glmer(convergence ~ gender + age + residence +
education + (1|lexical.item) + (1|speaker), data=vowels,
family='binomial')
This produced a result. Then, I ran
4. plot(allEffects(modelvowels))
and this gave four charts (for the four independent variables: gender, age,
residence and education).
Then, I moved to the qaaf dataset (4064 items) and ran the same model
5. modelqaaf <- glmer(convergence ~ gender + age + residence +
education + (1|lexical.item) + (1|speaker), data=qaaf,
family='binomial')
which gave results with the vowels dataset but there was a warning message
this time
6. Warning message:
In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
Model failed to converge with max|grad| = 0.429623 (tol = 0.001, component 8)
So, I removed one independent variable (residence) and ran this model again:
7. modelqaaf <- glmer(convergence ~ gender + age + education +
(1|lexical.item) + (1|speaker), data=qaaf, family='binomial')
This gave a result. I removed another independent variable (gender) after
returning (residence) and ran the model:
8. modelqaaf1 <- glmer(convergence ~ residence + age + education +
(1|lexical.item) + (1|speaker), data=q, family='binomial')
This gave a result as well. Then, I tried to create some graphs using
9. plot(allEffects(modelqaaf)) and
10. plot(allEffects(modelqaaf1))
but there was the same error for both
11. Error in as.data.frame.default(data, optional = TRUE) :
cannot coerce class ""function"" to a data.frame
Now, my questions:
a. why 1 did not work, why 3 worked, why 5 did not work though it has
the same four IVs of 3, why 7 and 8 worked with only three IVs, and
why 9 and 10 did not work though they are like 4 which worked well.
b. What are the packages that must be installed with, before or after
the lme4 package?
Best
--
Saudi Sadiq,
Assistant Lecturer, English Department,
Faculty of Al-Alsun,Minia University,
Minia City, Egypt &
PhD Student, Language and Linguistic Science Department,
University of York, York, North Yorkshire, UK,
YO10 5DD
http://york.academia.edu/SaudiSadiq
https://www.researchgate.net/profile/Saudi_Sadiq
Certified Interpreter by Pearl Linguistics
Forum for Arabic Linguistics conference رواق العربية
28-30th July 2015 - call for papers now open
https://sites.google.com/a/york.ac.uk/fal2015/
[[alternative HTML version deleted]]
More information about the R-help
mailing list