Re: [R-sig-eco] GLM: calculate percentage deviance of factor
Jade Maggs píše v Čt 01. 11. 2012 v 16:02 +0200: Dear list, I have run a generalized linear model with negative binomial distribution (log-link) on fish abundance data. log(abundTot) ~ Bo + B1(topog) + B2(activity) + e *My output is as follows**:* summary(glmNB1) Call: glm.nb(formula = abundTot ~ activity + topog, init.theta = 5.431057349, link = log) Deviance Residuals: Min 1Q Median 3Q Max -3.1348 -0.7846 -0.2781 0.3097 5.3866 Coefficients: Estimate Std. Error z value Pr(|z|) (Intercept) 2.652150.07810 33.958 2e-16 *** activity[T.hd] -0.044470.08299 -0.536 0.5921 activity[T.hfd] -0.449260.08884 -5.057 4.27e-07 *** activity[T.nil] 0.075100.05808 1.293 0.1960 topog0.030840.01546 1.995 0.0461 * --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 (Dispersion parameter for Negative Binomial(5.4311) family taken to be 1) Null deviance: 473.32 on 428 degrees of freedom Residual deviance: 428.00 on 424 degrees of freedom AIC: 2916.3 Number of Fisher Scoring iterations: 1 Theta: 5.431 Std. Err.: 0.485 2 x log-likelihood: -2904.260 *and* anova(glmNB1) Analysis of Deviance Table Model: Negative Binomial(5.4311), link: log Response: abundTot Terms added sequentially (first to last) Df Deviance Resid. Df Resid. Dev Pr(Chi) NULL 428 473.32 activity 3 41.272 425 432.05 5.726e-09 *** topog 14.053 424 428.000.0441 * --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Please can someone explain how to calculate the percentage deviance explained by each factor separately (i.e. topog and activity). Kind regards, Dear Jade, as far as I know (and feel free to correct me, anybody), traditional goodness of fit measure - R squared (or ratio of sum of squares) is not strictly defined for models other than linear. You should look for some alternative, eg. Nagelkerke's R-squared, but be warned that these alternatives sometimes lack some usual properties of R2 like aditivity - sum of Your explained variances for individual factors would not be the same as the explained variance of the full model. I hope this helps. Martin Weiser ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] patterns in weather data that could relate to pathogen prevalence
On 11/30/2012 01:09 PM, Anto Raja wrote: Hi all I am searching for a tool that would help me to identify weather patterns that influence the prevalence of a pathogen, 'Pn'. Say, I have annual prevalence data (collected in April) and I know that the prevalence of 'Pn' is affected by the weather conditions since November. I also have daily data for different weeather variables. You have a lot of weather data, but I assume you don't have so much prevalence data. So it's going to be difficult, whatever you do... The objective is to identify the relationship between the weather from Nov-Mar and the prevalence of Pn. We know that weather has an influence on Pn. The question is to find out weather from which period is relevant or what kind of weather is relevant. It could be that the first two winter months (Nov-Dec) is the decisive factor or that a certain weather situation (like 20 consecutive days of below zero conditions) occuring at any time is important or a combination of both. I have tried correlations between prevalence and monthly means for Mar, Feb-Mar, Jan-Mar and so on and nothing definite turned up. I could also do it on a weekly basis manually. But I wonder if there is a tool that uses a moving window of different sizes (say, from a min size of 1 week to a max of 4 months) and checks correlations for each of these periods. I am thinking of ARMA, but my present intention is not to forecast but only to study. Can it still be used? Or ARMA in combination with multivariate analysis to study the relative importance of each weather variable. I don't see why an ARMA model would help you, as that assumes a covariance between times (i.e. autocorrelation) in the response (i.e. prevalence). There are methods for assuming that the response has an autocorrelation, but I don't think that's your big problem. My reaction (without seeing the data, of course) is that you might be asking too much of your data to get anything meaningful out of it. Any suugestions are welcome. I have used R for basic stats analysis but never worked with time-series data or the advanced tools of data mining. So, it could also be possible I am not thinking along the right lines. Feel free to correct if I am looking in the wrong place. It sounds like you're trying to mine your data for any pattern. To be honest, if you do that, I wouldn't trust the results unless you can validate them independently: you'll find some relationship if you try enough models, but will it make biological sense? This is particularly problematic when you have correlated variables, which you will do (especially when you start sliding windows around) I'd suggest you start by using what's known of the pathogen or its host, or of similar host-pathogen systems, to develop a smaller number of hypotheses about what sort of effects are likely. Plant ecologists often use GDD5 (Growing Degree Days above 5°C), which might be a useful way of reducing the temperature data to something smaller. Of course, another temperature than 5°C might work better for you. Bob -- Bob O'Hara Biodiversity and Climate Research Centre Senckenberganlage 25 D-60325 Frankfurt am Main, Germany Tel: +49 69 7542 1863 / +49 69 798 40226 Mobile: +49 1515 888 5440 WWW: http://www.bik-f.de/root/index.php?page_id=219 Blog: http://blogs.nature.com/boboh Journal of Negative Results - EEB: www.jnr-eeb.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] GLM: calculate percentage deviance of factor
Hi Jade, You should look into the hier.part package. I know it works for glm but you might try it for glm.nb. Best, Tim On Fri, Nov 30, 2012 at 6:40 AM, Martin Weiser weis...@natur.cuni.czwrote: Jade Maggs pí¹e v Èt 01. 11. 2012 v 16:02 +0200: Dear list, I have run a generalized linear model with negative binomial distribution (log-link) on fish abundance data. log(abundTot) ~ Bo + B1(topog) + B2(activity) + e *My output is as follows**:* summary(glmNB1) Call: glm.nb(formula = abundTot ~ activity + topog, init.theta = 5.431057349, link = log) Deviance Residuals: Min 1Q Median 3Q Max -3.1348 -0.7846 -0.2781 0.3097 5.3866 Coefficients: Estimate Std. Error z value Pr(|z|) (Intercept) 2.652150.07810 33.958 2e-16 *** activity[T.hd] -0.044470.08299 -0.536 0.5921 activity[T.hfd] -0.449260.08884 -5.057 4.27e-07 *** activity[T.nil] 0.075100.05808 1.293 0.1960 topog0.030840.01546 1.995 0.0461 * --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 (Dispersion parameter for Negative Binomial(5.4311) family taken to be 1) Null deviance: 473.32 on 428 degrees of freedom Residual deviance: 428.00 on 424 degrees of freedom AIC: 2916.3 Number of Fisher Scoring iterations: 1 Theta: 5.431 Std. Err.: 0.485 2 x log-likelihood: -2904.260 *and* anova(glmNB1) Analysis of Deviance Table Model: Negative Binomial(5.4311), link: log Response: abundTot Terms added sequentially (first to last) Df Deviance Resid. Df Resid. Dev Pr(Chi) NULL 428 473.32 activity 3 41.272 425 432.05 5.726e-09 *** topog 14.053 424 428.000.0441 * --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Please can someone explain how to calculate the percentage deviance explained by each factor separately (i.e. topog and activity). Kind regards, Dear Jade, as far as I know (and feel free to correct me, anybody), traditional goodness of fit measure - R squared (or ratio of sum of squares) is not strictly defined for models other than linear. You should look for some alternative, eg. Nagelkerke's R-squared, but be warned that these alternatives sometimes lack some usual properties of R2 like aditivity - sum of Your explained variances for individual factors would not be the same as the explained variance of the full model. I hope this helps. Martin Weiser ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology [[alternative HTML version deleted]] ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] Zuur / Pinierho / Faraway
Philip, IS there an online errata,or do you just have to be smart and diligent? Thanks, Dave On 11/29/2012 07:30 AM, Dixon, Philip M [STAT] wrote: I agree with all the previous comments and second Tom's recommendations of Faraway as an 'in between' Zuur and Piniehro Bates. One thing to be careful of: While the advice in Faraway is sound, there are more than a few mistakes in his equations. Philip Dixon ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology -- David W. Roberts office 406-994-4548 Professor and Head FAX 406-994-3190 Department of Ecology email drobe...@montana.edu Montana State University Bozeman, MT 59717-3460 ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] Zuur / Pinierho / Faraway
At least some errata at: http://www.maths.bath.ac.uk/~jjf23/ELM/ http://www.maths.bath.ac.uk/~jjf23/ELM/errata.html Tom 2 On Fri, Nov 30, 2012 at 10:47 AM, Dave Roberts dvr...@ecology.msu.montana.edu wrote: Philip, IS there an online errata,or do you just have to be smart and diligent? Thanks, Dave On 11/29/2012 07:30 AM, Dixon, Philip M [STAT] wrote: I agree with all the previous comments and second Tom's recommendations of Faraway as an 'in between' Zuur and Piniehro Bates. One thing to be careful of: While the advice in Faraway is sound, there are more than a few mistakes in his equations. Philip Dixon __**_ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/**listinfo/r-sig-ecologyhttps://stat.ethz.ch/mailman/listinfo/r-sig-ecology -- ~~**~~** David W. Roberts office 406-994-4548 Professor and Head FAX 406-994-3190 Department of Ecology email drobe...@montana.edu Montana State University Bozeman, MT 59717-3460 __**_ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/**listinfo/r-sig-ecologyhttps://stat.ethz.ch/mailman/listinfo/r-sig-ecology -- --- Tom Philippi, Ph.D. Quantitative Ecologist Data Therapist Inventory and Monitoring Program National Park Service (619) 523-4576 tom_phili...@nps.gov http://science.nature.nps.gov/im/monitor [[alternative HTML version deleted]] ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology