Re: [R] Extracting overdispersion estimates from lmer amd glm objects
PS, the equivalent for a glm is: > sum.modeltest <- summary(modeltest) > sum.modeltest$dispersion Hope this helps. On 11/09/06, Toby Gardner <[EMAIL PROTECTED]> wrote: > Dear list, > > I am needing to extract the estimate of overdispersion (deviance / residual > degrees of freedom or c-hat) from multiple model objects - so they can then > be used to compare the extent of overdispersion among alternative models as > well as calculate qausi-AIC values. I have been unable to do this, despite > consulting a number of manuals and searching the R-help. I am imaging that > in theory it should be possible with some call to attr(), but i have so far > had no success. > > An example model output would be: > > > modeltest<-lmer(Coleodactylus_amazonicus_N~USD + > > (1|site),data=SFArray,family=poisson,method="Laplace",control=list(usePQL=FALSE, > > msVerbose=TRUE)) > > summary(modeltest) > > > > Generalized linear mixed model fit using Laplace > Formula: Coleodactylus_amazonicus_N ~ USD + (1 | site) >Data: SFArray > Family: poisson(log link) > AIC BIClogLik deviance > 75.94996 81.68603 -34.97498 69.94996 > Random effects: > Groups NameVariance Std.Dev. > site (Intercept) 2.6076 1.6148 > number of obs: 50, groups: site, 5 > > Estimated scale (compare to 1) 1.080798 > > > > What I need is to extract this value (1.080798) from multiple lmer objects. > Has anyone any recommendations? I also need to do this for glm objects > although I suspect if someone was able to kindly point me in the right > direction then the solution is likely to be similar. > > Very many thanks, > > Toby Gardner > > > sessionInfo() > Version 2.3.1 (2006-06-01) > i386-pc-mingw32 > > attached base packages: > [1] "datasets" "graphics" "grDevices" "methods" "stats" "utils" > "base" > > other attached packages: >JGR iplots JavaGD lme4 Matrixlattice MASS > rJava >"1.4-7""1.0-3""0.3-4" "0.995-2" "0.995-15" "0.13-8" "7.2-27.1" > "0.4-6" > > > School of Environmental Sciences > University of East Anglia > Norwich, NR4 7TJ > United Kingdom > Email: [EMAIL PROTECTED] > Website: www.uea.ac.uk/~e387495 > > [[alternative HTML version deleted]] > > __ > R-help@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 > and provide commented, minimal, self-contained, reproducible code. > -- = David Barron Said Business School University of Oxford Park End Street Oxford OX1 1HP __ R-help@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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] Extracting overdispersion estimates from lmer amd glm objects
You can extract it from a summary.lmer object, which has a slot names "sigma" that contains this scale parameter. For example, > sum.modeltest <- summary(modeltest) > [EMAIL PROTECTED] On 11/09/06, Toby Gardner <[EMAIL PROTECTED]> wrote: > Dear list, > > I am needing to extract the estimate of overdispersion (deviance / residual > degrees of freedom or c-hat) from multiple model objects - so they can then > be used to compare the extent of overdispersion among alternative models as > well as calculate qausi-AIC values. I have been unable to do this, despite > consulting a number of manuals and searching the R-help. I am imaging that > in theory it should be possible with some call to attr(), but i have so far > had no success. > > An example model output would be: > > > modeltest<-lmer(Coleodactylus_amazonicus_N~USD + > > (1|site),data=SFArray,family=poisson,method="Laplace",control=list(usePQL=FALSE, > > msVerbose=TRUE)) > > summary(modeltest) > > > > Generalized linear mixed model fit using Laplace > Formula: Coleodactylus_amazonicus_N ~ USD + (1 | site) >Data: SFArray > Family: poisson(log link) > AIC BIClogLik deviance > 75.94996 81.68603 -34.97498 69.94996 > Random effects: > Groups NameVariance Std.Dev. > site (Intercept) 2.6076 1.6148 > number of obs: 50, groups: site, 5 > > Estimated scale (compare to 1) 1.080798 > > > > What I need is to extract this value (1.080798) from multiple lmer objects. > Has anyone any recommendations? I also need to do this for glm objects > although I suspect if someone was able to kindly point me in the right > direction then the solution is likely to be similar. > > Very many thanks, > > Toby Gardner > > > sessionInfo() > Version 2.3.1 (2006-06-01) > i386-pc-mingw32 > > attached base packages: > [1] "datasets" "graphics" "grDevices" "methods" "stats" "utils" > "base" > > other attached packages: >JGR iplots JavaGD lme4 Matrixlattice MASS > rJava >"1.4-7""1.0-3""0.3-4" "0.995-2" "0.995-15" "0.13-8" "7.2-27.1" > "0.4-6" > > > School of Environmental Sciences > University of East Anglia > Norwich, NR4 7TJ > United Kingdom > Email: [EMAIL PROTECTED] > Website: www.uea.ac.uk/~e387495 > > [[alternative HTML version deleted]] > > __ > R-help@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 > and provide commented, minimal, self-contained, reproducible code. > -- = David Barron Said Business School University of Oxford Park End Street Oxford OX1 1HP __ R-help@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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] Extracting overdispersion estimates from lmer amd glm objects
summary(modeltest)@sigma Toby Gardner wrote: > Dear list, > > I am needing to extract the estimate of overdispersion (deviance / residual > degrees of freedom or c-hat) from multiple model objects - so they can then > be used to compare the extent of overdispersion among alternative models as > well as calculate qausi-AIC values. I have been unable to do this, despite > consulting a number of manuals and searching the R-help. I am imaging that > in theory it should be possible with some call to attr(), but i have so far > had no success. > > An example model output would be: > > >> modeltest<-lmer(Coleodactylus_amazonicus_N~USD + >> (1|site),data=SFArray,family=poisson,method="Laplace",control=list(usePQL=FALSE, >> msVerbose=TRUE)) >> summary(modeltest) >> > > > > Generalized linear mixed model fit using Laplace > Formula: Coleodactylus_amazonicus_N ~ USD + (1 | site) >Data: SFArray > Family: poisson(log link) > AIC BIClogLik deviance > 75.94996 81.68603 -34.97498 69.94996 > Random effects: > Groups NameVariance Std.Dev. > site (Intercept) 2.6076 1.6148 > number of obs: 50, groups: site, 5 > > Estimated scale (compare to 1) 1.080798 > > > > What I need is to extract this value (1.080798) from multiple lmer objects. > Has anyone any recommendations? I also need to do this for glm objects > although I suspect if someone was able to kindly point me in the right > direction then the solution is likely to be similar. > > Very many thanks, > > Toby Gardner > > >> sessionInfo() >> > Version 2.3.1 (2006-06-01) > i386-pc-mingw32 > > attached base packages: > [1] "datasets" "graphics" "grDevices" "methods" "stats" "utils" > "base" > > other attached packages: >JGR iplots JavaGD lme4 Matrixlattice MASS > rJava >"1.4-7""1.0-3""0.3-4" "0.995-2" "0.995-15" "0.13-8" "7.2-27.1" > "0.4-6" > > > School of Environmental Sciences > University of East Anglia > Norwich, NR4 7TJ > United Kingdom > Email: [EMAIL PROTECTED] > Website: www.uea.ac.uk/~e387495 > > [[alternative HTML version deleted]] > > __ > R-help@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 > and provide commented, minimal, self-contained, reproducible code. > > -- Simon Blomberg, B.Sc.(Hons.), Ph.D, M.App.Stat. Centre for Resource and Environmental Studies The Australian National University Canberra ACT 0200 Australia T: +61 2 6125 7800 email: Simon.Blomberg_at_anu.edu.au F: +61 2 6125 0757 CRICOS Provider # 00120C 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. __ R-help@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 and provide commented, minimal, self-contained, reproducible code.
[R] Extracting overdispersion estimates from lmer amd glm objects
Dear list, I am needing to extract the estimate of overdispersion (deviance / residual degrees of freedom or c-hat) from multiple model objects - so they can then be used to compare the extent of overdispersion among alternative models as well as calculate qausi-AIC values. I have been unable to do this, despite consulting a number of manuals and searching the R-help. I am imaging that in theory it should be possible with some call to attr(), but i have so far had no success. An example model output would be: > modeltest<-lmer(Coleodactylus_amazonicus_N~USD + > (1|site),data=SFArray,family=poisson,method="Laplace",control=list(usePQL=FALSE, > msVerbose=TRUE)) > summary(modeltest) Generalized linear mixed model fit using Laplace Formula: Coleodactylus_amazonicus_N ~ USD + (1 | site) Data: SFArray Family: poisson(log link) AIC BIClogLik deviance 75.94996 81.68603 -34.97498 69.94996 Random effects: Groups NameVariance Std.Dev. site (Intercept) 2.6076 1.6148 number of obs: 50, groups: site, 5 Estimated scale (compare to 1) 1.080798 What I need is to extract this value (1.080798) from multiple lmer objects. Has anyone any recommendations? I also need to do this for glm objects although I suspect if someone was able to kindly point me in the right direction then the solution is likely to be similar. Very many thanks, Toby Gardner > sessionInfo() Version 2.3.1 (2006-06-01) i386-pc-mingw32 attached base packages: [1] "datasets" "graphics" "grDevices" "methods" "stats" "utils" "base" other attached packages: JGR iplots JavaGD lme4 Matrixlattice MASS rJava "1.4-7""1.0-3""0.3-4" "0.995-2" "0.995-15" "0.13-8" "7.2-27.1" "0.4-6" School of Environmental Sciences University of East Anglia Norwich, NR4 7TJ United Kingdom Email: [EMAIL PROTECTED] Website: www.uea.ac.uk/~e387495 [[alternative HTML version deleted]] __ R-help@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 and provide commented, minimal, self-contained, reproducible code.