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]]
Dear Saudi Sadiq, If you want answers to most of your questions, you'll likely have to provide your data so that people can reproduce the errors. I can, however, answer part of your last question without the data: plot(allEffects(modelqaaf1)) fails because the data set is named q, and there is a standard R function named q(). Obviously there is a scoping issue that confuses allEffects() for a reason I don't yet understand. Here's a simple example that reproduces this error: ---------- snip ------------> library(lme4)Loading required package: Matrix Loading required package: Rcpp> library(effects) > fm1 <- lmer(angle ~ recipe * temperature + (1|recipe:replicate), cake) > allEffects(fm1)model: angle ~ recipe * temperature recipe*temperature effect temperature recipe 175 185 195 205 215 225 A 29.13333 31.53333 30.80000 33.53333 38.66667 35.06667 B 26.86667 29.40000 31.73333 32.13333 34.46667 35.26667 C 27.93333 28.93333 31.73333 30.86667 34.40000 35.73333> q <- cake > fm1 <- lmer(angle ~ recipe * temperature + (1|recipe:replicate), data=q) > allEffects(fm1)Error in as.data.frame.default(data, optional = TRUE) : cannot coerce class ""function"" to a data.frame ------------- snip ------------- Why, as you claim, you get the same error with plot(allEffects(modelqaaf)), where the data set is qaaf rather than q, is hard to understand, and perhaps you're mistaken. I hope this helps, John ------------------------------------------------ John Fox, Professor McMaster University Hamilton, Ontario, Canada http://socserv.mcmaster.ca/jfox/ On Wed, 1 Jul 2015 15:40:48 +0100 Saudi Sadiq <ss1272 at york.ac.uk> wrote:> 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]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
Hi Jon, Thanks for your reply. I will try again, after correcting mistakes. Then, if the model does not converge, I will come back to you with datasets attached. Best On 1 July 2015 at 21:01, John Fox <jfox at mcmaster.ca> wrote:> Dear Saudi Sadiq, > > If you want answers to most of your questions, you'll likely have to > provide your data so that people can reproduce the errors. I can, however, > answer part of your last question without the data: > > plot(allEffects(modelqaaf1)) fails because the data set is named q, and > there is a standard R function named q(). Obviously there is a scoping > issue that confuses allEffects() for a reason I don't yet understand. > > Here's a simple example that reproduces this error: > > ---------- snip ------------ > > > library(lme4) > Loading required package: Matrix > Loading required package: Rcpp > > library(effects) > > fm1 <- lmer(angle ~ recipe * temperature + (1|recipe:replicate), cake) > > allEffects(fm1) > model: angle ~ recipe * temperature > > recipe*temperature effect > temperature > recipe 175 185 195 205 215 225 > A 29.13333 31.53333 30.80000 33.53333 38.66667 35.06667 > B 26.86667 29.40000 31.73333 32.13333 34.46667 35.26667 > C 27.93333 28.93333 31.73333 30.86667 34.40000 35.73333 > > q <- cake > > fm1 <- lmer(angle ~ recipe * temperature + (1|recipe:replicate), data=q) > > allEffects(fm1) > > Error in as.data.frame.default(data, optional = TRUE) : > cannot coerce class ""function"" to a data.frame > > ------------- snip ------------- > > Why, as you claim, you get the same error with > plot(allEffects(modelqaaf)), where the data set is qaaf rather than q, is > hard to understand, and perhaps you're mistaken. > > I hope this helps, > John > > ------------------------------------------------ > John Fox, Professor > McMaster University > Hamilton, Ontario, Canada > http://socserv.mcmaster.ca/jfox/ > > > On Wed, 1 Jul 2015 15:40:48 +0100 > Saudi Sadiq <ss1272 at york.ac.uk> wrote: > > 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]] > > > > ______________________________________________ > > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > > > >-- 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]]