I am trying to use the LME package to run a multilevel logistic model using the following code: ------------------------------------------------------------------------ ------------------------------------------- Model1 = GLMM(WEAP ~ TSRAT2 , random = ~1 | GROUP , family = binomial, na.action = na.omit ) ------------------------------------------------------------------------ ------------------------------------------- Where WEAP is a dichotomous outcome measure, TSRAT2 is a group level covariate, and GROUP is the grouping variable. I do not have significant missing data and the dataset is over 15000 cases. I have tried changing the outcome measure(s) and predictor(s) with the same result. Each time R fails and returns the following message: ------------------------------------------------------------------------ ------------------------------------------------ structure(list( : flist must be a non-empty list of factors ------------------------------------------------------------------------ ------------------------------------------------ This appears to be problem with the grouping variable, yet there are no missing values and the data were sorted on this variable prior to being read into R. Any suggestions would be greatly appreciated. Robert Bossarte, PhD EIS Officer Division of Violence Prevention National Center for Injury Prevention and Control Centers for Disease Control and Prevention 4770 Buford Highway, NE - Mailstop K-60 Atlanta, GA 30341 (770) 488-1529 [[alternative HTML version deleted]]
Bossarte, Robert wrote:> I am trying to use the LME package to run a multilevel logistic model > using the following code: > > > > ------------------------------------------------------------------------ > ------------------------------------------- > > > > Model1 = GLMM(WEAP ~ TSRAT2 , random = ~1 | GROUP , family = binomial, > na.action = na.omit ) > > > > ------------------------------------------------------------------------ > ------------------------------------------- > > > > Where WEAP is a dichotomous outcome measure, TSRAT2 is a group level > covariate, and GROUP is the grouping variable. > > > > I do not have significant missing data and the dataset is over 15000 > cases. > > > > I have tried changing the outcome measure(s) and predictor(s) with the > same result. Each time R fails and returns the following message: > > > > ------------------------------------------------------------------------ > ------------------------------------------------ > > > > structure(list( : flist must be a non-empty list of factors > > > > ------------------------------------------------------------------------ > ------------------------------------------------ > > > > This appears to be problem with the grouping variable, yet there are no > missing values and the data were sorted on this variable prior to being > read into R.Is the grouping variable a factor? Check with str(GROUP) If it isn't a factor then convert it a factor using GROUP <- factor(GROUP)> > > > Any suggestions would be greatly appreciated.
I am trying to use R. My question is if R can calculate a random effect probit model {e.g. glmm} but including sampling weights. I am desperately looking for a random effect model but wanted to use it on survey data. Thanks for an answer: Niko Speybroeck.
Hi Dimitris, Thanks a lot for the answer! I see that in glmm you can specify "weight=" but this is according to me corresponding to for example the frequency of a certain observation and not to an weighing factor because of the sampling design. Tell me if I'm wrong. Do you have an example with GLMM or glmmPQL, in which you use sampling (probability) weights? Thanks in advance. Niko ________________________________ Van: Dimitris Rizopoulos [mailto:dimitris.rizopoulos at med.kuleuven.ac.be] Verzonden: do 2/09/2004 10:51 Aan: Niko Speybroeck CC: r-help at stat.math.ethz.ch Onderwerp: Re: [R] glmm Hi Niko, look at functions `GLMM' (package: lme4) and `glmmPQL' (package: MASS). Best, Dimitris ---- Dimitris Rizopoulos Doctoral Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/16/396887 Fax: +32/16/337015 Web: http://www.med.kuleuven.ac.be/biostat/ http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm ----- Original Message ----- From: "Niko Speybroeck" <NSpeybroeck at itg.be> To: <R-help at stat.math.ethz.ch> Sent: Thursday, September 02, 2004 10:42 AM Subject: [R] glmm> > I am trying to use R. My question is if R can calculate a randomeffect> probit model {e.g. glmm} but including sampling weights. I amdesperately> looking for a random effect model but wanted to use it on surveydata.> > Thanks for an answer: Niko Speybroeck. > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide!http://www.R-project.org/posting-guide.html
Thanks a lot for you answer Thomas. Do you have a reference which supports this solution? Can you give an example of a weight that depends on variables that shouldn't be in the model? ________________________________ Van: Thomas Lumley [mailto:tlumley at u.washington.edu] Verzonden: do 2/09/2004 16:15 Aan: Dimitris Rizopoulos CC: Niko Speybroeck; r-help at stat.math.ethz.ch Onderwerp: Re: [R] glmm On Thu, 2 Sep 2004, Dimitris Rizopoulos wrote:> Hi Niko, > > look at functions `GLMM' (package: lme4) and `glmmPQL' (package: > MASS).Yes, but they don't take sampling weights. We had this discussion a while back for linear mixed models and no-one had a really satisfactory solution. In contrast to most simple regression models, mixed models don't even give the right point estimates when you use sampling weights and pretend they are precision weights. I think the best solution that was suggested is to put the weights in the model as a predictor (unless they depend on variables that shouldn't be in the model). As the weights completely describe the biased sampling, this will give a valid model-based analysis. For a design-based analysis you are probably out of luck. -thomas> > Best, > Dimitris > > ---- > Dimitris Rizopoulos > Doctoral Student > Biostatistical Centre > School of Public Health > Catholic University of Leuven > > Address: Kapucijnenvoer 35, Leuven, Belgium > Tel: +32/16/396887 > Fax: +32/16/337015 > Web: http://www.med.kuleuven.ac.be/biostat/ > http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm > > > ----- Original Message ----- > From: "Niko Speybroeck" <NSpeybroeck at itg.be> > To: <R-help at stat.math.ethz.ch> > Sent: Thursday, September 02, 2004 10:42 AM > Subject: [R] glmm > > > > > > I am trying to use R. My question is if R can calculate a random > effect > > probit model {e.g. glmm} but including sampling weights. I am > desperately > > looking for a random effect model but wanted to use it on survey > data. > > > > Thanks for an answer: Niko Speybroeck. > > > > ______________________________________________ > > R-help at stat.math.ethz.ch mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide!http://www.R-project.org/posting-guide.html>Thomas Lumley Assoc. Professor, Biostatistics tlumley at u.washington.edu University of Washington, Seattle
I believe in the earlier discussion it was Spencer Graves that pointed out that there is earlier work by DuMouchel using design information but not weights as predictors. The reference for the use of design weights as predictors is: <<<Start insert from earlier email<<< < 9. Pfeffermann, D. , Skinner, C. J. , Holmes, D. J. , Goldstein, H. , and Rasbash, J. (1998), ``Weighting for unequal selection probabilities in multilevel models (Disc: p41-56)'', Journal of the Royal Statistical Society, Series B, Methodological, 60 , 23-40 > which refers back to: <29. Pfeffermann, D. , and LaVange, L. (1989), ``Regression models for stratified multi-stage cluster samples'', Analysis of Complex Surveys, 237-260 > If you don't like statistical papers, then see section 4.5 of <8. Korn, Edward Lee , and Graubard, Barry I. (1999), ``Analysis of health surveys'', John Wiley & Sons (New York; Chichester) > They explain the idea of using weights in a model fairly simply.>>>End insert>>>In the earlier discussion Thomas Lumley pointed out that this means your resulting estimates are conditional on the weights - so it's not a good solution - just the only one published using weights. I believe there is a Bayesian solution in the vein of Ghosh & Meeden (1997-Chapman Hall) but it hasn't been published. And my personal opinion is that before anyone uses design weights they should read: http://www-unix.oit.umass.edu/~cluster/ed/outline/c00ed72.PDF bob -----Original Message----- From: Niko Speybroeck [mailto:NSpeybroeck at itg.be] Sent: Thursday, September 02, 2004 10:28 AM To: Thomas Lumley; Dimitris Rizopoulos Cc: r-help at stat.math.ethz.ch Subject: RE: [R] glmm Thanks a lot for you answer Thomas. Do you have a reference which supports this solution? Can you give an example of a weight that depends on variables that shouldn't be in the model? ________________________________ Van: Thomas Lumley [mailto:tlumley at u.washington.edu] Verzonden: do 2/09/2004 16:15 Aan: Dimitris Rizopoulos CC: Niko Speybroeck; r-help at stat.math.ethz.ch Onderwerp: Re: [R] glmm On Thu, 2 Sep 2004, Dimitris Rizopoulos wrote:> Hi Niko, > > look at functions `GLMM' (package: lme4) and `glmmPQL' (package: > MASS).Yes, but they don't take sampling weights. We had this discussion a while back for linear mixed models and no-one had a really satisfactory solution. In contrast to most simple regression models, mixed models don't even give the right point estimates when you use sampling weights and pretend they are precision weights. I think the best solution that was suggested is to put the weights in the model as a predictor (unless they depend on variables that shouldn't be in the model). As the weights completely describe the biased sampling, this will give a valid model-based analysis. For a design-based analysis you are probably out of luck. -thomas> > Best, > Dimitris > > ---- > Dimitris Rizopoulos > Doctoral Student > Biostatistical Centre > School of Public Health > Catholic University of Leuven > > Address: Kapucijnenvoer 35, Leuven, Belgium > Tel: +32/16/396887 > Fax: +32/16/337015 > Web: http://www.med.kuleuven.ac.be/biostat/ > http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm > > > ----- Original Message ----- > From: "Niko Speybroeck" <NSpeybroeck at itg.be> > To: <R-help at stat.math.ethz.ch> > Sent: Thursday, September 02, 2004 10:42 AM > Subject: [R] glmm > > > > > > I am trying to use R. My question is if R can calculate a random > effect > > probit model {e.g. glmm} but including sampling weights. I am > desperately > > looking for a random effect model but wanted to use it on survey > data. > > > > Thanks for an answer: Niko Speybroeck. > > > > ______________________________________________ > > R-help at stat.math.ethz.ch mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide!http://www.R-project.org/posting-guide.html>Thomas Lumley Assoc. Professor, Biostatistics tlumley at u.washington.edu University of Washington, Seattle ______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html