Re: [R] Predicted values for zero-inflated Poisson
Alain- Thanks again for the response. I guess my question is more related to R, which I'm learning as I go along. Could you provide guidance as to how I would code this in R? Thanks, Laura From: Alain Zuur [via R] [mailto:ml-node+s789695n4635920...@n4.nabble.com] Sent: Monday, July 09, 2012 5:20 PM To: Lee, Laura Subject: Re: Predicted values for zero-inflated Poisson Laura Lee laura.lee at ncdenr.gov Mon Jul 9 22:51:40 CEST 2012 Previous message: [R] Predicted values for zero-inflated Poisson Next message: [R] Lavaan Package - How to Extract Residuals in Data Values Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] Thanks for your reply. I do have a copy of Zero Inflated Models and Generalized Linear Mixed Models with R and have been using that as a guide. I applied the predict function (type=count) to the dataset for which I built the model to compare the predicted bycatch numbers to the observed to ensure I was doing things correctly. When I summed over the new predicted variable, the value is over 500 whereas there were less than 10 observed. I'd appreciate any advice regarding what I'm doing wrong. -- View this message in context: http://r.789695.n4.nabble.com/Predicted-values-for-zero-inflated-Poisson-tp4635861p4635916.html Sent from the R help mailing list archive at Nabble.com. AFZ: Laurano...you don't want to compare the count part of the model with raw datayou need to compare the Exp(Y) = (1-pi) * mu with the raw data. Have a look at the Epilogue chapterit shows the difference between mu and (1-pi) * mu. Alain -- Dr. Alain F. Zuur First author of: 1. Analysing Ecological Data (2007). Zuur, AF, Ieno, EN and Smith, GM. Springer. 680 p. URL: www.springer.com/0-387-45967-7http://www.springer.com/0-387-45967-7 2. Mixed effects models and extensions in ecology with R. (2009). Zuur, AF, Ieno, EN, Walker, N, Saveliev, AA, and Smith, GM. Springer. http://www.springer.com/life+sci/ecology/book/978-0-387-87457-9 3. A Beginner's Guide to R (2009). Zuur, AF, Ieno, EN, Meesters, EHWG. Springer http://www.springer.com/statistics/computational/book/978-0-387-93836-3 4. Zero Inflated Models and Generalized Linear Mixed Models with R. (2012) Zuur, Saveliev, Ieno. http://www.highstat.com/book4.htm Other books: http://www.highstat.com/books.htm Statistical consultancy, courses, data analysis and software Highland Statistics Ltd. 6 Laverock road UK - AB41 6FN Newburgh Tel: 0044 1358 788177 Email: [hidden email]/user/SendEmail.jtp?type=nodenode=4635920i=0 URL: www.highstat.comhttp://www.highstat.com URL: www.brodgar.comhttp://www.brodgar.com [[alternative HTML version deleted]] __ [hidden email]/user/SendEmail.jtp?type=nodenode=4635920i=1 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. Dr. Alain F. Zuur First author of: 1. Analysing Ecological Data (2007). Zuur, AF, Ieno, EN and Smith, GM. Springer. 680 p. URL: www.springer.com/0-387-45967-7http://www.springer.com/0-387-45967-7 2. Mixed effects models and extensions in ecology with R. (2009). Zuur, AF, Ieno, EN, Walker, N, Saveliev, AA, and Smith, GM. Springer. http://www.springer.com/life+sci/ecology/book/978-0-387-87457-9 3. A Beginner's Guide to R (2009). Zuur, AF, Ieno, EN, Meesters, EHWG. Springer http://www.springer.com/statistics/computational/book/978-0-387-93836-3 Other books: http://www.highstat.com/books.htm Statistical consultancy, courses, data analysis and software Highland Statistics Ltd. 6 Laverock road UK - AB41 6FN Newburgh Tel: 0044 1358 788177 Email: highs...@highstat.commailto:highs...@highstat.com URL: www.highstat.comhttp://www.highstat.com URL: www.brodgar.comhttp://www.brodgar.com If you reply to this email, your message will be added to the discussion below: http://r.789695.n4.nabble.com/Predicted-values-for-zero-inflated-Poisson-tp4635861p4635920.html To unsubscribe from Predicted values for zero-inflated Poisson, click herehttp://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=4635861code=bGF1cmEubGVlQG5jZGVuci5nb3Z8NDYzNTg2MXw0NTg5ODY5NTk=. NAMLhttp://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml - Laura M. Lee Senior Stock Assessment Scientist North Carolina Division of Marine Fisheries E-Mail: laura@ncdenr.gov -- View this message in context: http://r.789695.n4.nabble.com/Predicted-values-for-zero-inflated-Poisson-tp4635861p4635978.html Sent from the R help mailing
Re: [R] Predicted values for zero-inflated Poisson
On Tue, 10 Jul 2012, Laura Lee wrote: Alain- Thanks again for the response. I guess my question is more related to R, which I'm learning as I go along. Could you provide guidance as to how I would code this in R? That depends on what exactly you want to predict. As Alain said: The type=count predictions are probably not interesting to you. In the JSS paper accompanying zeroinfl, these correspond to exp(x'b) in Equation 8. More interesting is probably the mean (1 - pi) * exp(x'b) which is the expected mean mu_i in Equation 8. This can be obtained as type=response. Additionally, you might be interested in the individual probabilities for counts of 0, 1, 2, ... etc. This corresponds to evaluating Equation 7 for y = 0, 1, 2, ... which can be obtained via type=prob. And from this you could also get the mode or median rather than the mean of the distribution. hth, Z Thanks, Laura From: Alain Zuur [via R] [mailto:ml-node+s789695n4635920...@n4.nabble.com] Sent: Monday, July 09, 2012 5:20 PM To: Lee, Laura Subject: Re: Predicted values for zero-inflated Poisson Laura Lee laura.lee at ncdenr.gov Mon Jul 9 22:51:40 CEST 2012 Previous message: [R] Predicted values for zero-inflated Poisson Next message: [R] Lavaan Package - How to Extract Residuals in Data Values Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] Thanks for your reply. I do have a copy of Zero Inflated Models and Generalized Linear Mixed Models with R and have been using that as a guide. I applied the predict function (type=count) to the dataset for which I built the model to compare the predicted bycatch numbers to the observed to ensure I was doing things correctly. When I summed over the new predicted variable, the value is over 500 whereas there were less than 10 observed. I'd appreciate any advice regarding what I'm doing wrong. -- View this message in context: http://r.789695.n4.nabble.com/Predicted-values-for-zero-inflated-Poisson-tp4635861p4635916.html Sent from the R help mailing list archive at Nabble.com. AFZ: Laurano...you don't want to compare the count part of the model with raw datayou need to compare the Exp(Y) = (1-pi) * mu with the raw data. Have a look at the Epilogue chapterit shows the difference between mu and (1-pi) * mu. Alain -- Dr. Alain F. Zuur First author of: 1. Analysing Ecological Data (2007). Zuur, AF, Ieno, EN and Smith, GM. Springer. 680 p. URL: www.springer.com/0-387-45967-7http://www.springer.com/0-387-45967-7 2. Mixed effects models and extensions in ecology with R. (2009). Zuur, AF, Ieno, EN, Walker, N, Saveliev, AA, and Smith, GM. Springer. http://www.springer.com/life+sci/ecology/book/978-0-387-87457-9 3. A Beginner's Guide to R (2009). Zuur, AF, Ieno, EN, Meesters, EHWG. Springer http://www.springer.com/statistics/computational/book/978-0-387-93836-3 4. Zero Inflated Models and Generalized Linear Mixed Models with R. (2012) Zuur, Saveliev, Ieno. http://www.highstat.com/book4.htm Other books: http://www.highstat.com/books.htm Statistical consultancy, courses, data analysis and software Highland Statistics Ltd. 6 Laverock road UK - AB41 6FN Newburgh Tel: 0044 1358 788177 Email: [hidden email]/user/SendEmail.jtp?type=nodenode=4635920i=0 URL: www.highstat.comhttp://www.highstat.com URL: www.brodgar.comhttp://www.brodgar.com [[alternative HTML version deleted]] __ [hidden email]/user/SendEmail.jtp?type=nodenode=4635920i=1 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. Dr. Alain F. Zuur First author of: 1. Analysing Ecological Data (2007). Zuur, AF, Ieno, EN and Smith, GM. Springer. 680 p. URL: www.springer.com/0-387-45967-7http://www.springer.com/0-387-45967-7 2. Mixed effects models and extensions in ecology with R. (2009). Zuur, AF, Ieno, EN, Walker, N, Saveliev, AA, and Smith, GM. Springer. http://www.springer.com/life+sci/ecology/book/978-0-387-87457-9 3. A Beginner's Guide to R (2009). Zuur, AF, Ieno, EN, Meesters, EHWG. Springer http://www.springer.com/statistics/computational/book/978-0-387-93836-3 Other books: http://www.highstat.com/books.htm Statistical consultancy, courses, data analysis and software Highland Statistics Ltd. 6 Laverock road UK - AB41 6FN Newburgh Tel: 0044 1358 788177 Email: highs...@highstat.commailto:highs...@highstat.com URL: www.highstat.comhttp://www.highstat.com URL: www.brodgar.comhttp://www.brodgar.com If you reply to this email, your message will be added to the discussion below: http://r.789695.n4.nabble.com/Predicted-values-for-zero-inflated-Poisson-tp4635861p4635920.html To unsubscribe from Predicted values for zero-inflated Poisson, click herehttp://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode
Re: [R] Predicted values for zero-inflated Poisson
I want to predict the number of turtles for different levels of effort and combinations of covariates. So, for my dataset from which I built the model, would I compare sum(predict(ZIP,type=response)) to the observed bycatch to compare numbers? In order to predict for the new data (called effort), would I use sum(predict(ZIP,newdata=effort,type=response))? I want to be certain I am understanding the coding--this is my first time using the predict function. Thanks, Laura - Laura M. Lee Senior Stock Assessment Scientist North Carolina Division of Marine Fisheries E-Mail: laura@ncdenr.gov -- View this message in context: http://r.789695.n4.nabble.com/Predicted-values-for-zero-inflated-Poisson-tp4635861p4636016.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Predicted values for zero-inflated Poisson
*Laura Lee* laura.lee at ncdenr.gov mailto:r-help%40r-project.org?Subject=Re%3A%20%5BR%5D%20Predicted%20values%20for%20zero-inflated%20PoissonIn-Reply-To=%3C1341937636301-4636016.post%40n4.nabble.com%3E /Tue Jul 10 18:27:16 CEST 2012/ I want to predict the number of turtles for different levels of effort and combinations of covariates. So, for my dataset from which I built the model, would I compare sum(predict(ZIP,type=response)) to the observed bycatch to compare numbers? In order to predict for the new data (called effort), would I use sum(predict(ZIP,newdata=effort,type=response))? I want to be certain I am understanding the coding--this is my first time using the predict function. Thanks, Laura Laura Why do you use the sum? If you use: PredY - predict(ZIP, type = response) then you have predicted values for each of the rows in your effort data frame. Job done. You have an offset in your model, isn't it? You will need to choose values for this in the data frame effort as well. Also double check that the offset is only in the count partat least that is what I would do. Note that using an offset means that you assume that if sampling effort is doubled, your fish (?) numbers double. If you fully want to understand what predict is doing, try to do it manually. Below is R code from Chapter 7 (Zero Inflation and GLMM with R) M3 - zeroinfl(ParrotFish ~ Depth + Slope + SQDistRck + DistSed + Swell + Chla + SST, dist = poisson, link = logit, data = PF2) Betas.logistic - coef(M3, model = zero) X.logistic - model.matrix(M3, model = zero) eta.logistic - X.logistic %*% Betas.logistic p - exp(eta.logistic) / (1 + exp(eta.logistic)) Betas.log - coef(M3, model = count) X.log - model.matrix(M3, model = count) eta.log- X.log %*% Betas.log mu - exp(eta.log) ExpY - mu * (1 - p) VarY - (1 - p) * (mu + p * mu^2) Instead of using model.matrix(M3), you could specify your own data frame with covariates. Your effort. Something like: M4 - zeroinfl(ParrotFish ~ Depth + Slope | SST, dist = poisson, link = logit, data = PF2) betapois - coef(M4, model = count) betaBin - coef(M4, model = zero) MyDataPois - data.frame(Depth = blah blah, Slope = Blah blah) MyDataBin - data.frame(SST = blah) Xpois - model.matrix(~ blah blah, data = MyDataPois) Xbin - model.matrix(~ blah blah, data = MyDataBin) eta.Pois - Xpois %*% betapois eta.Bin - blah blah mu = blah blah pi = blah blah ExpY = ... Doing it like this means you fully understand it..:-) Alain -- Dr. Alain F. Zuur First author of: 1. Analysing Ecological Data (2007). Zuur, AF, Ieno, EN and Smith, GM. Springer. 680 p. URL: www.springer.com/0-387-45967-7 2. Mixed effects models and extensions in ecology with R. (2009). Zuur, AF, Ieno, EN, Walker, N, Saveliev, AA, and Smith, GM. Springer. http://www.springer.com/life+sci/ecology/book/978-0-387-87457-9 3. A Beginner's Guide to R (2009). Zuur, AF, Ieno, EN, Meesters, EHWG. Springer http://www.springer.com/statistics/computational/book/978-0-387-93836-3 4. Zero Inflated Models and Generalized Linear Mixed Models with R. (2012) Zuur, Saveliev, Ieno. http://www.highstat.com/book4.htm Other books: http://www.highstat.com/books.htm Statistical consultancy, courses, data analysis and software Highland Statistics Ltd. 6 Laverock road UK - AB41 6FN Newburgh Tel: 0044 1358 788177 Email: highs...@highstat.com URL: www.highstat.com URL: www.brodgar.com [[alternative HTML version deleted]] __ R-help@r-project.org 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] Predicted values for zero-inflated Poisson
Alain- Thanks again for your reply. Yes, the offset for effort is only in the count part of the model. Sorry I wasn't clear about why I was using 'sum'...my effort data set contains records of trips with the effort given for each trip. I thought using sum would get me the total number of turtles predicted for the new effort data. I did also log-transform the effort in the new effort data before applying predict (correct?). I will try the manual method as you recommended to help me understand the code. Thanks, Laura From: Alain Zuur [via R] [mailto:ml-node+s789695n4636025...@n4.nabble.com] Sent: Tuesday, July 10, 2012 1:52 PM To: Lee, Laura Subject: Re: Predicted values for zero-inflated Poisson *Laura Lee* laura.lee at ncdenr.gov mailto:r-help%40r-project.org?Subject=Re%3A%20%5BR%5D%20Predicted%20values%20for%20zero-inflated%20PoissonIn-Reply-To=%3C1341937636301-4636016.post%40n4.nabble.com%3E /Tue Jul 10 18:27:16 CEST 2012/ I want to predict the number of turtles for different levels of effort and combinations of covariates. So, for my dataset from which I built the model, would I compare sum(predict(ZIP,type=response)) to the observed bycatch to compare numbers? In order to predict for the new data (called effort), would I use sum(predict(ZIP,newdata=effort,type=response))? I want to be certain I am understanding the coding--this is my first time using the predict function. Thanks, Laura Laura Why do you use the sum? If you use: PredY - predict(ZIP, type = response) then you have predicted values for each of the rows in your effort data frame. Job done. You have an offset in your model, isn't it? You will need to choose values for this in the data frame effort as well. Also double check that the offset is only in the count partat least that is what I would do. Note that using an offset means that you assume that if sampling effort is doubled, your fish (?) numbers double. If you fully want to understand what predict is doing, try to do it manually. Below is R code from Chapter 7 (Zero Inflation and GLMM with R) M3 - zeroinfl(ParrotFish ~ Depth + Slope + SQDistRck + DistSed + Swell + Chla + SST, dist = poisson, link = logit, data = PF2) Betas.logistic - coef(M3, model = zero) X.logistic - model.matrix(M3, model = zero) eta.logistic - X.logistic %*% Betas.logistic p - exp(eta.logistic) / (1 + exp(eta.logistic)) Betas.log - coef(M3, model = count) X.log - model.matrix(M3, model = count) eta.log- X.log %*% Betas.log mu - exp(eta.log) ExpY - mu * (1 - p) VarY - (1 - p) * (mu + p * mu^2) Instead of using model.matrix(M3), you could specify your own data frame with covariates. Your effort. Something like: M4 - zeroinfl(ParrotFish ~ Depth + Slope | SST, dist = poisson, link = logit, data = PF2) betapois - coef(M4, model = count) betaBin - coef(M4, model = zero) MyDataPois - data.frame(Depth = blah blah, Slope = Blah blah) MyDataBin - data.frame(SST = blah) Xpois - model.matrix(~ blah blah, data = MyDataPois) Xbin - model.matrix(~ blah blah, data = MyDataBin) eta.Pois - Xpois %*% betapois eta.Bin - blah blah mu = blah blah pi = blah blah ExpY = ... Doing it like this means you fully understand it..:-) Alain -- Dr. Alain F. Zuur First author of: 1. Analysing Ecological Data (2007). Zuur, AF, Ieno, EN and Smith, GM. Springer. 680 p. URL: www.springer.com/0-387-45967-7http://www.springer.com/0-387-45967-7 2. Mixed effects models and extensions in ecology with R. (2009). Zuur, AF, Ieno, EN, Walker, N, Saveliev, AA, and Smith, GM. Springer. http://www.springer.com/life+sci/ecology/book/978-0-387-87457-9 3. A Beginner's Guide to R (2009). Zuur, AF, Ieno, EN, Meesters, EHWG. Springer http://www.springer.com/statistics/computational/book/978-0-387-93836-3 4. Zero Inflated Models and Generalized Linear Mixed Models with R. (2012) Zuur, Saveliev, Ieno. http://www.highstat.com/book4.htm Other books: http://www.highstat.com/books.htm Statistical consultancy, courses, data analysis and software Highland Statistics Ltd. 6 Laverock road UK - AB41 6FN Newburgh Tel: 0044 1358 788177 Email: [hidden email]/user/SendEmail.jtp?type=nodenode=4636025i=0 URL: www.highstat.comhttp://www.highstat.com URL: www.brodgar.comhttp://www.brodgar.com [[alternative HTML version deleted]] __ [hidden email]/user/SendEmail.jtp?type=nodenode=4636025i=1 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. Dr. Alain F. Zuur First author of: 1. Analysing Ecological Data (2007). Zuur, AF, Ieno, EN and Smith, GM. Springer. 680 p. URL:
[R] Predicted values for zero-inflated Poisson
Hi all- I fit a zero-inflated Poisson model to model bycatch rates using an offset term for effort. I need to apply the fitted model to a datasets of varying levels of effort to predict the associated levels of bycatch. I am seeking assistance as to the correct way to code this. Thanks in advance! Laura [[alternative HTML version deleted]] __ R-help@r-project.org 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] Predicted values for zero-inflated Poisson
Lee, Laura wrote Hi all- I fit a zero-inflated Poisson model to model bycatch rates using an offset term for effort. I need to apply the fitted model to a datasets of varying levels of effort to predict the associated levels of bycatch. I am seeking assistance as to the correct way to code this. --- Just use the function zeroinfl from the pscl package...fit your model...extract the estimated parameters, specify a data frame with variables for which you want to make predictions (including values for your offset), use model.matrix to convert it into the correct format and calculate your fitted values. You can also use the function predict. You can either predict the binary (pi) and count parts (mu), or the predicted values for the ZIP ((1-pi)*mu)..or better...both. For detailed examples and code see: Zero Inflated Models and Generalized Linear Mixed Models with R. (2012) Zuur, Saveliev, Ieno. http://www.highstat.com/book4.htm Alain -- Dr. Alain F. Zuur First author of: 1. Analysing Ecological Data (2007). Zuur, AF, Ieno, EN and Smith, GM. Springer. 680 p. URL: www.springer.com/0-387-45967-7 2. Mixed effects models and extensions in ecology with R. (2009). Zuur, AF, Ieno, EN, Walker, N, Saveliev, AA, and Smith, GM. Springer. http://www.springer.com/life+sci/ecology/book/978-0-387-87457-9 3. A Beginner's Guide to R (2009). Zuur, AF, Ieno, EN, Meesters, EHWG. Springer http://www.springer.com/statistics/computational/book/978-0-387-93836-3 4. Zero Inflated Models and Generalized Linear Mixed Models with R. (2012) Zuur, Saveliev, Ieno. http://www.highstat.com/book4.htm Other books: http://www.highstat.com/books.htm Statistical consultancy, courses, data analysis and software Highland Statistics Ltd. 6 Laverock road UK - AB41 6FN Newburgh Tel: 0044 1358 788177 Email: highs...@highstat.com URL: www.highstat.com URL: www.brodgar.com Thanks in advance! Laura [[alternative HTML version deleted]] __ R-help@ 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. - Dr. Alain F. Zuur First author of: 1. Analysing Ecological Data (2007). Zuur, AF, Ieno, EN and Smith, GM. Springer. 680 p. URL: www.springer.com/0-387-45967-7 2. Mixed effects models and extensions in ecology with R. (2009). Zuur, AF, Ieno, EN, Walker, N, Saveliev, AA, and Smith, GM. Springer. http://www.springer.com/life+sci/ecology/book/978-0-387-87457-9 3. A Beginner's Guide to R (2009). Zuur, AF, Ieno, EN, Meesters, EHWG. Springer http://www.springer.com/statistics/computational/book/978-0-387-93836-3 Other books: http://www.highstat.com/books.htm Statistical consultancy, courses, data analysis and software Highland Statistics Ltd. 6 Laverock road UK - AB41 6FN Newburgh Tel: 0044 1358 788177 Email: highs...@highstat.com URL: www.highstat.com URL: www.brodgar.com -- View this message in context: http://r.789695.n4.nabble.com/Predicted-values-for-zero-inflated-Poisson-tp4635861p4635898.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Predicted values for zero-inflated Poisson
Thanks for your reply. I do have a copy of Zero Inflated Models and Generalized Linear Mixed Models with R and have been using that as a guide. I applied the predict function (type=count) to the dataset for which I built the model to compare the predicted bycatch numbers to the observed to ensure I was doing things correctly. When I summed over the new predicted variable, the value is over 500 whereas there were less than 10 observed. I'd appreciate any advice regarding what I'm doing wrong. -- View this message in context: http://r.789695.n4.nabble.com/Predicted-values-for-zero-inflated-Poisson-tp4635861p4635916.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Predicted values for zero-inflated Poisson
Laura Lee laura.lee at ncdenr.gov Mon Jul 9 22:51:40 CEST 2012 Previous message: [R] Predicted values for zero-inflated Poisson Next message: [R] Lavaan Package - How to Extract Residuals in Data Values Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] Thanks for your reply. I do have a copy of Zero Inflated Models and Generalized Linear Mixed Models with R and have been using that as a guide. I applied the predict function (type=count) to the dataset for which I built the model to compare the predicted bycatch numbers to the observed to ensure I was doing things correctly. When I summed over the new predicted variable, the value is over 500 whereas there were less than 10 observed. I'd appreciate any advice regarding what I'm doing wrong. -- View this message in context: http://r.789695.n4.nabble.com/Predicted-values-for-zero-inflated-Poisson-tp4635861p4635916.html Sent from the R help mailing list archive at Nabble.com. AFZ: Laurano...you don't want to compare the count part of the model with raw datayou need to compare the Exp(Y) = (1-pi) * mu with the raw data. Have a look at the Epilogue chapterit shows the difference between mu and (1-pi) * mu. Alain -- Dr. Alain F. Zuur First author of: 1. Analysing Ecological Data (2007). Zuur, AF, Ieno, EN and Smith, GM. Springer. 680 p. URL: www.springer.com/0-387-45967-7 2. Mixed effects models and extensions in ecology with R. (2009). Zuur, AF, Ieno, EN, Walker, N, Saveliev, AA, and Smith, GM. Springer. http://www.springer.com/life+sci/ecology/book/978-0-387-87457-9 3. A Beginner's Guide to R (2009). Zuur, AF, Ieno, EN, Meesters, EHWG. Springer http://www.springer.com/statistics/computational/book/978-0-387-93836-3 4. Zero Inflated Models and Generalized Linear Mixed Models with R. (2012) Zuur, Saveliev, Ieno. http://www.highstat.com/book4.htm Other books: http://www.highstat.com/books.htm Statistical consultancy, courses, data analysis and software Highland Statistics Ltd. 6 Laverock road UK - AB41 6FN Newburgh Tel: 0044 1358 788177 Email: highs...@highstat.com URL: www.highstat.com URL: www.brodgar.com [[alternative HTML version deleted]] __ R-help@r-project.org 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.