Re: [R] Predicted values for zero-inflated Poisson

2012-07-09 Thread Alain Zuur

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] Checking for normality and homogeneity of variance

2010-01-05 Thread Alain Zuur


Haiyang AI wrote:
> 
> Dear all,
> 
> I'm a beginner of R and I need to carry out some three-way mixed ANOVAs.
> Following examples at http://personality-project.org/r/r.anova.html, I
> managed to get the ANOVA part, but I don't know how can I check data
> normality and homogeneity of variance in R (since they're the required
> assumptions of ANOVA analysis).
> 
> 


No..normality and homogeneity of the data it is not an assumption! It is
normality and homogeneity of the residuals!

See also:
http://www3.interscience.wiley.com/cgi-bin/fulltext/122683826/PDFSTART


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


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://n4.nabble.com/Checking-for-normality-and-homogeneity-of-variance-tp998821p998923.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.


[R] Paper on data exploration

2009-11-16 Thread Alain Zuur

R users doing data analysis may be interested in the following paper:

http://methodsblog.wordpress.com/2009/11/13/first-paper-now-online/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+wordpress%2Fmethodsblog+(methods.blog)

All data and R code is available.

Alain


-

Dr. Alain F. Zuur
First author of:

1. Analysing Ecological Data (2007).
Zuur, AF, Ieno, EN and Smith, GM. Springer. 680 p.

2. Mixed effects models and extensions in ecology with R. (2009).
Zuur, AF, Ieno, EN, Walker, N, Saveliev, AA, and Smith, GM. Springer.

3. A Beginner's Guide to R (2009).
Zuur, AF, Ieno, EN, Meesters, EHWG. Springer


Statistical consultancy, courses, data analysis and software
Highland Statistics Ltd.
6 Laverock road
UK - AB41 6FN Newburgh
Email: highs...@highstat.com
URL: www.highstat.com



-- 
View this message in context: 
http://old.nabble.com/Paper-on-data-exploration-tp26382087p26382087.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] how to fit time varying coefficient regression model?

2009-10-06 Thread Alain Zuur



R_help Help wrote:
> 
> Hi - I read through dse package manual a bit. I'm not quite certain
> how I can use it to estimate a time varying coefficient regression
> model? I might pick up an inappropriate package. Any suggestion would
> be greatly appreciated. Thank you.
> 
> 
> Just rewrite the linear regression model into state-space equations, and
> apply Kalman filtering. See Chapter 16 or 17 in our Analysing Ecological
> Data book. There will be packages in R that can do kalman filtering and
> smoothing
> 
> Alain
> 
> 
> 
> 
> 
> rh
> 
> __
> 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.
> 
> 


-

Dr. Alain F. Zuur
First author of:

1. Analysing Ecological Data (2007).
Zuur, AF, Ieno, EN and Smith, GM. Springer. 680 p.

2. Mixed effects models and extensions in ecology with R. (2009).
Zuur, AF, Ieno, EN, Walker, N, Saveliev, AA, and Smith, GM. Springer.

3. A Beginner's Guide to R (2009).
Zuur, AF, Ieno, EN, Meesters, EHWG. Springer


Statistical consultancy, courses, data analysis and software
Highland Statistics Ltd.
6 Laverock road
UK - AB41 6FN Newburgh
Email: highs...@highstat.com
URL: www.highstat.com



-- 
View this message in context: 
http://www.nabble.com/how-to-fit-time-varying-coefficient-regression-model--tp25762040p25770615.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] GLM quasipoisson error

2009-10-06 Thread Alain Zuur



atorso wrote:
> 
> Hello,
> 
> I'm having an error when trying to fit the next GLM:
> 
>>>model<-glm(response ~ CLONE_M + CLONE_F + HATCHING
> +(CLONE_M*CLONE_F) + (CLONE_M*HATCHING) + (CLONE_F*HATCHING) +
> (CLONE_M*CLONE_F*HATCHING), family=quasipoisson)
>>> anova(model, test="Chi")
> 
> 
> 
> 
> 
> I guess that those variables are factors, and that you have empty
> combinations? Make a coplot, and see whether you have data for all
> combinations of the levels of your factors. Formulated differently..does
> it make sense, or is it possible to fit the 3-way interaction for your
> data?
> 
> Also..you may want to use the str command to see whether "response" is
> indeed coded correctly.
> 
> Alain
> 
>>Error in if (dispersion == 1) Inf else object$df.residual : 
>   missing value where TRUE/FALSE needed
> 
> If I fit the same model by using the Poisson distribution, it works.
> 
> I have not a clue about where the problem could be. Do you have any
> idea or suggestion I could try?
> 
> Thank you in advance, 
> 
> Ana 
> 
> __
> 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.
> 
> 


-

Dr. Alain F. Zuur
First author of:

1. Analysing Ecological Data (2007).
Zuur, AF, Ieno, EN and Smith, GM. Springer. 680 p.

2. Mixed effects models and extensions in ecology with R. (2009).
Zuur, AF, Ieno, EN, Walker, N, Saveliev, AA, and Smith, GM. Springer.

3. A Beginner's Guide to R (2009).
Zuur, AF, Ieno, EN, Meesters, EHWG. Springer


Statistical consultancy, courses, data analysis and software
Highland Statistics Ltd.
6 Laverock road
UK - AB41 6FN Newburgh
Email: highs...@highstat.com
URL: www.highstat.com



-- 
View this message in context: 
http://www.nabble.com/GLM-quasipoisson-error-tp25754404p25770491.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] Dealing with heterogeneity with varComb weights

2009-09-17 Thread Alain Zuur



RS27 wrote:
> 
> Hi,
> I am trying to add multiple variance structures such as the first example
> below:
> 
> vf1 <- varComb(varIdent(form = ~1|Sex), varPower())
> 
> However my code below will not work can anybody please advise me?
> 
> VFcomb<-varComb(varExp(form=~depcptwithextybf),varFixed(form=~FebNAO))
> 
> 
> 
> VarFixed won't work if FebNAO has values equal to 0. In fact, I wouldn't
> use varFixed at all. 
> 
> 
> A bit more info on the error message would be handy...
> 
> Alain
> 
> 
> also if you have two variables with the same weights function would you
> write that as:
> 
> VFcomb<-varComb(varExp(form=~depcptwithextybf),varExp(form=~FebNAO))
> 
> thanks
> Rebecca
> 
> 
> 


-

Dr. Alain F. Zuur
First author of:

1. Analysing Ecological Data (2007).
Zuur, AF, Ieno, EN and Smith, GM. Springer. 680 p.

2. Mixed effects models and extensions in ecology with R. (2009).
Zuur, AF, Ieno, EN, Walker, N, Saveliev, AA, and Smith, GM. Springer.

3. A Beginner's Guide to R (2009).
Zuur, AF, Ieno, EN, Meesters, EHWG. Springer


Statistical consultancy, courses, data analysis and software
Highland Statistics Ltd.
6 Laverock road
UK - AB41 6FN Newburgh
Email: highs...@highstat.com
URL: www.highstat.com



-- 
View this message in context: 
http://www.nabble.com/Dealing-with-heterogeneity-with-varComb-weights-tp25491971p25491989.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] Using anova(f1, f2) to compare lmer models yields seemingly erroneous Chisq = 0, p = 1

2009-09-07 Thread Alain Zuur



rapton wrote:
> 
> Hello,
> 
> I am using R to analyze a large multilevel data set, using
> lmer() to model my data, and using anova() to compare the fit of various
> models.  When I run two models, the output of each model is generated
> correctly as far as I can tell (e.g. summary(f1) and summary(f2) for the
> multilevel model output look perfectly reasonable), and in this case (see
> below) predictor.1 explains vastly more variance in outcome than
> predictor.2
> (R2 = 15% vs. 5% in OLS regression, with very large N).  What I am utterly
> puzzled by is that when I run an anova comparing the two multilevel model
> fits, the Chisq comes back as 0, with p = 1.  I am pretty sure that fit #1
> (f1) is a much better predictor of the outcome than f2, which is reflected
> in the AIC, BIC , and logLik values.  Why might anova be giving me this
> curious output?  How can I fix it?  I am sure I am making a dumb error
> somewhere, but I cannot figure out what it is.  Any help or suggestions
> would 
> be greatly appreciated!
> 
> -Matt
> 
> 
>> f1 <- (lmer(outcome ~ predictor.1 + (1 | person), data=i))
>> f2 <- (lmer(outcome ~ predictor.2 + (1 | person), data=i))
>> anova(f1, f2)
> 
> Data: i
> Models:
> f1: outcome ~ predictor.1 + (1 | person)
> f2: outcome ~ predictor.2 + (1 | person)
>DfAIC  BIClogLik   Chisq Chi Df Pr(>Chisq)
> f1  6  45443  45489 -22715
> f2 25  47317  47511 -23633 0 19  1
> 


** NOT  ** nested   sorrythe brain is going faster than the
fingers.





-

Dr. Alain F. Zuur
First author of:

1. Analysing Ecological Data (2007).
Zuur, AF, Ieno, EN and Smith, GM. Springer. 680 p.

2. Mixed effects models and extensions in ecology with R. (2009).
Zuur, AF, Ieno, EN, Walker, N, Saveliev, AA, and Smith, GM. Springer.

3. A Beginner's Guide to R (2009).
Zuur, AF, Ieno, EN, Meesters, EHWG. Springer


Statistical consultancy, courses, data analysis and software
Highland Statistics Ltd.
6 Laverock road
UK - AB41 6FN Newburgh
Email: highs...@highstat.com
URL: www.highstat.com



-- 
View this message in context: 
http://www.nabble.com/Using-anova%28f1%2C-f2%29-to-compare-lmer-models-yields-seemingly-erroneous-Chisq-%3D-0%2C-p-%3D-1-tp25297254p25333148.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] Using anova(f1, f2) to compare lmer models yields seemingly erroneous Chisq = 0, p = 1

2009-09-07 Thread Alain Zuur



rapton wrote:
> 
> Hello,
> 
> I am using R to analyze a large multilevel data set, using
> lmer() to model my data, and using anova() to compare the fit of various
> models.  When I run two models, the output of each model is generated
> correctly as far as I can tell (e.g. summary(f1) and summary(f2) for the
> multilevel model output look perfectly reasonable), and in this case (see
> below) predictor.1 explains vastly more variance in outcome than
> predictor.2
> (R2 = 15% vs. 5% in OLS regression, with very large N).  What I am utterly
> puzzled by is that when I run an anova comparing the two multilevel model
> fits, the Chisq comes back as 0, with p = 1.  I am pretty sure that fit #1
> (f1) is a much better predictor of the outcome than f2, which is reflected
> in the AIC, BIC , and logLik values.  Why might anova be giving me this
> curious output?  How can I fix it?  I am sure I am making a dumb error
> somewhere, but I cannot figure out what it is.  Any help or suggestions
> would 
> be greatly appreciated!
> 
> -Matt
> 
> 
>> f1 <- (lmer(outcome ~ predictor.1 + (1 | person), data=i))
>> f2 <- (lmer(outcome ~ predictor.2 + (1 | person), data=i))
>> anova(f1, f2)
> 
> Data: i
> Models:
> f1: outcome ~ predictor.1 + (1 | person)
> f2: outcome ~ predictor.2 + (1 | person)
>DfAIC  BIClogLik   Chisq Chi Df Pr(>Chisq)
> f1  6  45443  45489 -22715
> f2 25  47317  47511 -23633 0 19  1
> 




Your models are nest nestedit doesn't make sense to do. 


Alain

-

Dr. Alain F. Zuur
First author of:

1. Analysing Ecological Data (2007).
Zuur, AF, Ieno, EN and Smith, GM. Springer. 680 p.

2. Mixed effects models and extensions in ecology with R. (2009).
Zuur, AF, Ieno, EN, Walker, N, Saveliev, AA, and Smith, GM. Springer.

3. A Beginner's Guide to R (2009).
Zuur, AF, Ieno, EN, Meesters, EHWG. Springer


Statistical consultancy, courses, data analysis and software
Highland Statistics Ltd.
6 Laverock road
UK - AB41 6FN Newburgh
Email: highs...@highstat.com
URL: www.highstat.com



-- 
View this message in context: 
http://www.nabble.com/Using-anova%28f1%2C-f2%29-to-compare-lmer-models-yields-seemingly-erroneous-Chisq-%3D-0%2C-p-%3D-1-tp25297254p25333120.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] lme, lmer, gls, and spatial autocorrelation

2009-08-25 Thread Alain Zuur



Ben Bolker wrote:
> 
> My two cents: this is a hard problem to do, period (not just in R).
> I would second the recommendation of the Dormann et al paper listed
> below; also see Zuur, Alain F., Elena N. Ieno, Neil J. Walker, Anatoly A.
> Saveliev, and Graham M. Smith. Mixed Effects Models and Extensions in
> Ecology with R. 1st ed. Springer, 2009.
> 
> 
> Thanks for the ref..:-)
> 
> The last chapter in the book discusses Poisson + auto-correlation with
> MCMC. It shouldn't be too difficult to replace the AR-1 by some of these
> spatial correlation structures...I guess...I hope.
> 
> 
> 




-

Dr. Alain F. Zuur
First author of:

1. Analysing Ecological Data (2007).
Zuur, AF, Ieno, EN and Smith, GM. Springer. 680 p.

2. Mixed effects models and extensions in ecology with R. (2009).
Zuur, AF, Ieno, EN, Walker, N, Saveliev, AA, and Smith, GM. Springer.

3. A Beginner's Guide to R (2009).
Zuur, AF, Ieno, EN, Meesters, EHWG. Springer


Statistical consultancy, courses, data analysis and software
Highland Statistics Ltd.
6 Laverock road
UK - AB41 6FN Newburgh
Email: highs...@highstat.com
URL: www.highstat.com



-- 
View this message in context: 
http://www.nabble.com/lme%2C-lmer%2C-gls%2C-and-spatial-autocorrelation-tp25120963p25142366.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] generalized linear models

2009-08-09 Thread Alain Zuur


annie Zhang wrote:
> 
> Hi, Milton,
> 
> Thank you for the reply. I tried, but it seems the problem is the column
> name of the test data is not the same as the column name of the training
> data. I didn't give the column name, the system seemed do. How to chang
> here?
> 
> Annie
> 
> On Fri, Aug 7, 2009 at 7:52 PM, milton ruser 
> wrote:
> 
>> Hi Annie,
>>
>> create a new data.frame with input variables having all predictors
>> variables on it.
>> after give a look at ?predict
>>
>> best wishes
>>
>> milton
>>
>>   On Fri, Aug 7, 2009 at 8:19 PM, annie Zhang
>> wrote:
>>
>>>  Hi, R users,
>>>
>>> I am trying to use glm to do logistic regression. I know generally when
>>> I
>>> have two covariates, say x1 and x2, then I do
>>> fit <- glm(y~x1+x2,famliy='binomial')
>>> But now my covariates form a n*p matrix, say x, so actually each column
>>> is
>>> a
>>> covariate. So I think I should do
>>> fit <- glm(y~x,family='binomial')
>>> Then I need to predict new data. How should I write the newdata? I tried
>>> several thing, all failed. The x in the fit is a matrix, but is a vector
>>> for
>>> the new data.
>>>
>>> Thank you,
>>> Annie
>>>
>>>[[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.
>>>
>>
>>
> 
>   [[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.
> 
> 


See:
?colnames

Alain



-

Dr. Alain F. Zuur
First author of:

1. Analysing Ecological Data (2007).
Zuur, AF, Ieno, EN and Smith, GM. Springer. 680 p.

2. Mixed effects models and extensions in ecology with R. (2009).
Zuur, AF, Ieno, EN, Walker, N, Saveliev, AA, and Smith, GM. Springer.

3. A Beginner's Guide to R (2009).
Zuur, AF, Ieno, EN, Meesters, EHWG. Springer


Statistical consultancy, courses, data analysis and software
Highland Statistics Ltd.
6 Laverock road
UK - AB41 6FN Newburgh
Email: highs...@highstat.com
URL: www.highstat.com



-- 
View this message in context: 
http://www.nabble.com/generalized-linear-models-tp24873759p24885065.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] Compare lm() to glm(family=poisson)

2009-08-01 Thread Alain Zuur



Mark Na wrote:
> 
> Dear R-helpers,
> I would like to compare the fit of two models, one of which I fit using
> lm()
> and the other using glm(family=poisson). The latter doesn't provide
> r-squared, so I wonder how to go about comparing these
> models (they have the same formula).
> 
> Thanks very much,
> 
> Mark Na
> 
>   [[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.
> 
> 


The decision which distribution to use (Normal versus Poisson) should be an
a priori choice. If you really want to compare them, then inspect the
residuals of both models and see which model doesn't have any residual
patterns.

Alain

-

Dr. Alain F. Zuur
First author of:

1. Analysing Ecological Data (2007).
Zuur, AF, Ieno, EN and Smith, GM. Springer. 680 p.

2. Mixed effects models and extensions in ecology with R. (2009).
Zuur, AF, Ieno, EN, Walker, N, Saveliev, AA, and Smith, GM. Springer.

3. A Beginner's Guide to R (2009).
Zuur, AF, Ieno, EN, Meesters, EHWG. Springer


Statistical consultancy, courses, data analysis and software
Highland Statistics Ltd.
6 Laverock road
UK - AB41 6FN Newburgh
Email: highs...@highstat.com
URL: www.highstat.com



-- 
View this message in context: 
http://www.nabble.com/Compare-lm%28%29-to-glm%28family%3Dpoisson%29-tp24764558p24772802.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] R book for economists

2009-08-01 Thread Alain Zuur



Thiemo Fetzer wrote:
> 
> Dear Group,
> 
> I am an economics student starting with PhD work in London. As preparation
> I
> would like to get to know R a little bit better. For Stata there are tons
> of
> books, however, can you recommend a book for R?
> 
> I have some substantiated econometrics knowledge, so it should be more a
> how-to book.
> 
> Best regards
> Thiemo
> 
> ---
> Thiemo Fetzer, Economist
> http://freigeist.devmag.net
> http://www.devmag.net
> 
> __
> 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.
> 
> 

Besides the other already mentioned econometrical references.if you are
willing to read a book with life science data, then try:

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


Alain



-

Dr. Alain F. Zuur
First author of:

1. Analysing Ecological Data (2007).
Zuur, AF, Ieno, EN and Smith, GM. Springer. 680 p.

2. Mixed effects models and extensions in ecology with R. (2009).
Zuur, AF, Ieno, EN, Walker, N, Saveliev, AA, and Smith, GM. Springer.

3. A Beginner's Guide to R (2009).
Zuur, AF, Ieno, EN, Meesters, EHWG. Springer


Statistical consultancy, courses, data analysis and software
Highland Statistics Ltd.
6 Laverock road
UK - AB41 6FN Newburgh
Email: highs...@highstat.com
URL: www.highstat.com



-- 
View this message in context: 
http://www.nabble.com/R-book-for-economists-tp24768682p24772774.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] Moving Average on Defined Intervals

2009-07-30 Thread Alain Zuur


Hadassa Brunschwig-2 wrote:
> 
> Hi all
> 
> I have been looking (in the help archives) for a function
> which does a moving average. Nothing new, I know.
> But I am looking for a function which is very flexible:
> The user should be able to input a vector of breaks
> which define the bins (and not just the number of observations in a bin).
> The function would then calculate which observations fall into this bin
> and calculate, say, an average.
> Another parameter should be the overlap (probably only when
> the breaks of the bins are equidistant).
> 
> I am sure I am not the first one to think about this problem.
> Thanks for any hints.
> Hadassa
> 
> 
> 
> -- 
> Hadassa Brunschwig
> PhD Student
> Department of Statistics
> The Hebrew University of Jerusalem
> http://www.stat.huji.ac.il
> 
> __
> 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.
> 
> 


I think you have to program that yourself...can't be difficultwill only
take 30 minutes. Something like:


MyFunction <- function(Y,MyBin){

#Create a new vector of the same length as Y that defines the groupings
#Something like:  1 1 1 1 2 2 2 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 6 6 6 6
6
# This is a bit of rep magic, and conditional statements.

#Apply sapply on Y using this new vector

}


Instead of this, you can also make a loop, bit it is a bit more old
fashioned.



Easy-peasy


Alain

-

Dr. Alain F. Zuur
First author of:

1. Analysing Ecological Data (2007).
Zuur, AF, Ieno, EN and Smith, GM. Springer. 680 p.

2. Mixed effects models and extensions in ecology with R. (2009).
Zuur, AF, Ieno, EN, Walker, N, Saveliev, AA, and Smith, GM. Springer.

3. A Beginner's Guide to R (2009).
Zuur, AF, Ieno, EN, Meesters, EHWG. Springer


Statistical consultancy, courses, data analysis and software
Highland Statistics Ltd.
6 Laverock road
UK - AB41 6FN Newburgh
Email: highs...@highstat.com
URL: www.highstat.com



-- 
View this message in context: 
http://www.nabble.com/Moving-Average-on-Defined-Intervals-tp24736116p24736192.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] Adding picture to graph?

2009-07-30 Thread Alain Zuur


Rainer M Krug-6 wrote:
> 
> Hi
> 
> while teaching R, the question came up if it would be possible to add
> a picture (saved on the HDD) to a graph (generated by plot()), which
> we could not answer.
> 
> 
> 
> It might easily kill a clean graph, but: is there a way of doing this,
> even one should not do it?
> 
> 
> On a similar line of thought: is it possibe to define own symbols so
> that they can be used in the plot function with pch=?
> 
> 
> Rainer
> 
> -- 
> Rainer M. Krug, Centre of Excellence for Invasion Biology,
> Stellenbosch University, South Africa
> 
> __
> 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.
> 
> 



See our "Beginner's Guide to R" for an example; a time series of the date
the penguins lay eggs is plotted, and a jpg with penguins is used as
background. The code is on the book's website at: www.highstat.com(follow
the link to the R book). 

It was quite a challenge to do this...not because of the R code (we used
Murrel, 2006)...but because of figuring out the optimal the size of the jpg.
R didn't like to use the original 5Mb jpg file. So..I had to reduce it size.

Alain Zuur




-

Dr. Alain F. Zuur
First author of:

1. Analysing Ecological Data (2007).
Zuur, AF, Ieno, EN and Smith, GM. Springer. 680 p.

2. Mixed effects models and extensions in ecology with R. (2009).
Zuur, AF, Ieno, EN, Walker, N, Saveliev, AA, and Smith, GM. Springer.

3. A Beginner's Guide to R (2009).
Zuur, AF, Ieno, EN, Meesters, EHWG. Springer


Statistical consultancy, courses, data analysis and software
Highland Statistics Ltd.
6 Laverock road
UK - AB41 6FN Newburgh
Email: highs...@highstat.com
URL: www.highstat.com



-- 
View this message in context: 
http://www.nabble.com/Adding-picture-to-graph--tp24714724p24736042.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] creating subsets within lm()

2009-07-30 Thread Alain Zuur


Thomas A. Groen wrote:
> 
> Dear All,
> 
> the lm() function has the possibility to create a subset of the
> possible explaining variables that you have. However, in the help
> there is no example how to use this subset option. I tried the
> following:
> 
> model<-lm(dependent.data$MPFD~.,data=explaining.data,subset=c(1,0,0,0,0,0,0,0,1,1,0,0))
> 
> MPFD is the dependent variable stored in the data frame
> dependent.data, and all 12 explaining variables are stored in the data
> frame explaining.data.
> 
> However, this yields a model with only an intercept, and the comment
> 
> "Coefficients: (12 not defined because of singularities)"
> 
> I hope anyone would be able to give me an example how to do this
> correctly.
> 
> Kind regards,
> Thomas
> 
> 
> 
> 
> 
> 
> 
> 
> ___
> 
> 



The subset option works on the rows of the data set. Not on the covariates.
You would have to do something like:

lm(blah blah, data=explaining.data[, pick your columns])
 

Alain Zuur

-

Dr. Alain F. Zuur
First author of:

1. Analysing Ecological Data (2007).
Zuur, AF, Ieno, EN and Smith, GM. Springer. 680 p.

2. Mixed effects models and extensions in ecology with R. (2009).
Zuur, AF, Ieno, EN, Walker, N, Saveliev, AA, and Smith, GM. Springer.

3. A Beginner's Guide to R (2009).
Zuur, AF, Ieno, EN, Meesters, EHWG. Springer


Statistical consultancy, courses, data analysis and software
Highland Statistics Ltd.
6 Laverock road
UK - AB41 6FN Newburgh
Email: highs...@highstat.com
URL: www.highstat.com



-- 
View this message in context: 
http://www.nabble.com/creating-subsets-within-lm%28%29-tp24735798p24735931.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] Multiple graphs

2009-07-28 Thread Alain Zuur



Data Analytics Corp. wrote:
> 
> Hi,
> 
> I wrote a simple master function, run(), that has inside six qplot 
> functions.  The goal is to type run() and have all six graphs appear as 
> separate windows so that I can copy them into PowerPoint for a client. 
> When I type run(), only the last graph appears, the first five 
> apparently being overwritten.  How do I get all six in separate windows, 
> ready for copying?
> 
> By the way, is the a way to create a PowerPoint deck directly in R the 
> way you can in S-Plus?
> 
> Thanks,
> 
> Walt
> 
> 
> 
> -- 
> 
> 
> Walter R. Paczkowski, Ph.D.
> Data Analytics Corp.
> 44 Hamilton Lane
> Plainsboro, NJ 08536
> 
> (V) 609-936-8999
> (F) 609-936-3733
> dataanalyt...@earthlink.net
> www.dataanalyticscorp.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.
> 
> 


There is an example in our "A Beginner's Guide to R" that exports the graphs
automatically to jpg files (from a  loop inside a function)...which you
could then import into powerpoint. But as you can see from the other post,
it can even be done automatically. 


Alain 

-

Dr. Alain F. Zuur
First author of:

1. Analysing Ecological Data (2007).
Zuur, AF, Ieno, EN and Smith, GM. Springer. 680 p.

2. Mixed effects models and extensions in ecology with R. (2009).
Zuur, AF, Ieno, EN, Walker, N, Saveliev, AA, and Smith, GM. Springer.

3. A Beginner's Guide to R (2009).
Zuur, AF, Ieno, EN, Meesters, EHWG. Springer


Statistical consultancy, courses, data analysis and software
Highland Statistics Ltd.
6 Laverock road
UK - AB41 6FN Newburgh
Email: highs...@highstat.com
URL: www.highstat.com



-- 
View this message in context: 
http://www.nabble.com/Multiple-graphs-tp24690227p24697026.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] local regression using loess

2009-07-28 Thread Alain Zuur


cindy Guo wrote:
> 
> Hi, All,
> 
> I have a dataset with binary response ( 0 and 1) and some numerical
> covariates. I know I can use logistic regression to fit the data. But I
> want
> to consider more locally. So I am wondering how can I fit the data with
> 'loess' function in R? And what will be the response: 0/1 or the
> probability
> in either group like in logistic regression?
> 
> Thank you,
> Cindy
> 
>   [[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.
> 
> 


Why don't you fit a GAM with a logistic link function and binomial
distirbution?

Alain


-

Dr. Alain F. Zuur
First author of:

1. Analysing Ecological Data (2007).
Zuur, AF, Ieno, EN and Smith, GM. Springer. 680 p.

2. Mixed effects models and extensions in ecology with R. (2009).
Zuur, AF, Ieno, EN, Walker, N, Saveliev, AA, and Smith, GM. Springer.

3. A Beginner's Guide to R (2009).
Zuur, AF, Ieno, EN, Meesters, EHWG. Springer


Statistical consultancy, courses, data analysis and software
Highland Statistics Ltd.
6 Laverock road
UK - AB41 6FN Newburgh
Email: highs...@highstat.com
URL: www.highstat.com



-- 
View this message in context: 
http://www.nabble.com/local-regression-using-loess-tp24689834p24696908.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] Re gression function lm() not giving proper results

2009-07-20 Thread Alain Zuur

Read the warning message! It has converted your variables into factors.
Figure out why...and you will have solved the problem.


Alain Zuur



moumita wrote:
> 
> *
> *
> 
> Hi ,
> 
> Can anyone help me please  with this problem?*
> *
> 
> *CASE-I*
> 
> all_raw_data_NAomitted is my data frame.It has columns with names i1 ,i2,
> i3,i4…, till i15.It has 291 rows actually ,couldn’t show here.
> 
> The data frame looks like this:--
> 
>i1 i2 i3 i4 i5 i6 i7 i8 i9 i10 i11 i12 i13 i14 i15
> 
> 22  2  2  2  2  2  2  2  2   2   1   2   2 3   2
> 
> 32  2  2  2  3  2  2  3  3   3   2   3   333
> 
> 42  2  2  2  2  2  2  1  1   1   2   1   222
> 
> 62  2  1  2  1  1  2  2  1   1   1   1   22   2
> 
> 83  2  2  2  3  3  3  2  3   2   3   2   332
> 
> 92  2  2  2  2  2  3  3  3   2   3   3   32   2
> 
> 10   1  1  1  1  1  1  1  1  1   1   1   1   11  1
> 
> 12   2  2  2  3  2  2  2  1  3   2   1   2   23   3
> 
> 
> 
> While doing regression  i1 being the dependent variable and i2 as the
> predictor  the outputs produced are not correct.The o/ps are as shown
> below:---
> 
> *all_raw_data_NAomitted$i1<-as.vector(as.matrix(all_raw_data_NAomitted$i1))
> all_raw_data_NAomitted$i2<-as.vector(as.matrix(all_raw_data_NAomitted$i2))
> *
> 
> *
> *
> 
> *fit<-lrm(i1 ~ i2 + NULL,all_raw_data_NAomitted)*
> 
>> source("regression.R")
> 
> [1] "Printing regression value."
> 
> Call:
> 
> lm(formula = i1 ~ i2, data = all_raw_data_NAomitted)
> 
> Residuals:
> 
>  Min   1Q   Median   3Q  Max
> 
> -1.46154 -0.19277 -0.03529 -0.03529  1.96471
> 
> *Coefficients:*
> 
> *Estimate Std. Error t value Pr(>|t|)*
> 
> *(Intercept)  1.192770.05302   22.50   <2e-16 
> 
> *i22  0.842520.06469   13.03   <2e-16 
> 
> *i23  1.527230.11021   13.86   <2e-16 
> 
> *i24  2.268770.14409   15.74   <2e-16 
> 
> ---
> 
> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
> 
> 
> 
> Residual standard error: 0.4831 on 287 degrees of freedom
> 
> Multiple R-squared: 0.5815, Adjusted R-squared: 0.5771
> 
> F-statistic: 132.9 on 3 and 287 DF,  p-value: < 2.2e-16
> 
> 
> 
> Error in main() :
> 
> In addition: Warning messages:
> 
> 1: In model.matrix.default(mt, mf, contrasts) :
> 
>   variable 'i1' converted to a factor
> 
> 2: In model.matrix.default(mt, mf, contrasts) :
> 
>   variable 'i2' converted to a factor
> 
> *The results produced are incorrect and do not match with SPSS results
> ,you
> can find it out having a look at the coefficients sections of the
> result.my
> variables were i1 and i2.*
> 
> 
> 
> *CASE-II*
> 
> Whereas  if I do this the results produced are correct:--
> 
>> d1<-c(1,2,3,NA,6,7,8)
> 
>> d2<-c(2,3,4,3,1,2,2)
> 
>> d3<-c(2,1,2,1,2,1,3)
> 
>> d4<-c(5,6,2,1,1,2,2)
> 
>> d<-data.frame(d1,d2,d3,d4)
> 
>> d
> 
>   d1 d2 d3 d4
> 
> 1  1  2  2  5
> 
> 2  2  3  1  6
> 
> 3  3  4  2  2
> 
> 4 NA  3  1  1
> 
> 5  6  1  2  1
> 
> 6  7  2  1  2
> 
> 7  8  2  3  2
> 
>> fit<-lm(d1 ~ d2+d3+d4)
> 
>> summary(fit)
> 
> 
> 
> Call:
> 
> lm(formula = d1 ~ d2 + d3 + d4)
> 
> 
> 
> Residuals:
> 
>   1   2   3   5   6   7
> 
> -1.7865  0.9698 -1.2250 -1.4802  1.2761  2.2459
> 
> 
> 
> Coefficients:
> 
> Estimate Std. Error t value Pr(>|t|)
> 
> (Intercept)   9.1912 5.1807   1.7740.218
> 
> d2   -0.7570 1.2208  -0.6200.598
> 
> d30.0151 1.7474   0.0090.994
> 
> d4   -0.9842 0.6772  -1.4530.283
> 
> 
> 
> Residual standard error: 2.692 on 2 degrees of freedom
> 
>   (1 observation deleted due to missingness)
> 
> Multiple R-squared: 0.6507, Adjusted R-squared: 0.1267
> 
> F-statistic: 1.242 on 3 and 2 DF,  p-value: 0.4751
> 
> In case – (I) if I make the individual columns as vectors also ,I do not
> get
> correct results.what could be the cause of the incorrect results produced.
> 
> 
> -- 
> Thanks
> Moumita
> 
>   [[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.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Regression-function-lm%28%29-not-giving-proper-results-tp24569513p24569838.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] Re gression for loop test HELP! URGENT!

2009-07-20 Thread Alain Zuur


Rbeginner wrote:
> 
> Hi everyone!
> I'm new to R, and I've sent this message as a non-member, but since it's
> pretty urgent, I'm sending it again now I'm on the mailing list (Thanks
> Daniel for your suggestion nevertheless).
> 
> I have calculated a regression in the form of M ~ D + O + S, and I would
> like to take this regression and test it with other samples, 5 sets of M,
> D,
> O, and S at a time(I actually have 2000 sets, so it's probably not
> efficient
> to make each a separate set and then index). Since I'll need to test the
> regression for 400 groups, I thought a for loop might be necessary. I've
> put
> everything into a data frame already. Can anyone tell me how to write the
> code? I'm especially not sure about how to do the for loop.
> And then how would I calculate the error of how well the test samples fit
> the original regression?
> This is for my internship, so it's very urgent.
> 
> 
> 
> 
> One option (out of the many):
> 
> for (i in 1:2000) {
>  
>  M <- lm(M ~ D + O + S, subset = blah blah, data = YourData)
>  print(summary(M))
> }
> 
> The "blah blah" select your rows of data for iteration i.
> 
> See also:
> 
> A Beginner's Guide to R (2009). Zuur, Ieno, Meesters. 
> 
> for something very similar. You can dump everything in a text file, or
> just extract the required info from the summary function (like R^2 etc).
> 
> Alain
> 
> 
> Dr. Alain F. Zuur
> First author of:
> 
> 1. Analysing Ecological Data (2007).
> Zuur, AF, Ieno, EN and Smith, GM. Springer. 680 p.
> 
> 2. Mixed effects models and extensions in ecology with R. (2009).
> Zuur, AF, Ieno, EN, Walker, N, Saveliev, AA, and Smith, GM. Springer.
> 
> 3. A Beginner's Guide to R (2009).
> Zuur, AF, Ieno, EN, Meesters, EHWG. Springer
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>   [[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.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Regression-for-loop-test-HELP%21-URGENT%21-tp24564236p24568726.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] Zinb for Non-interger data

2009-07-20 Thread Alain Zuur


JPS2009 wrote:
> 
> Sorry bit of a Newbie question, and I promise I have searched the forum
> already, but I'm getting a bit desperate!
> 
> I have over-dispersed, zero inflated data, with variance greater than the
> mean, suggesting Zero-Inflated Negative Binomial - which I attempted in R
> with the pscl package suggested on
> http://www.ats.ucla.edu/stat/R/dae/zinbreg.htm
> 
> However my data is non-integer with some pesky decimals (i.e. 33.12) and
> zinb / pscl doesn't like that - not surprising as zinb is for count data,
> normally whole integers etc.
> 
> Does anyone know of a different zinb package that will allow non-integers
> or and equivalent test/ model to zinb for non-integer data? Or should I
> try something else like a quasi-Poisson GLM?
> 
> 
> Apologies for the Newbie question! Any help much appreciated!
> Thanks!
> 

Is it really non-integer...or is it a density (in which case you could use
NB + offset)?


The quasi-Poisson will not help you with the zero inflation.
I'm afraid you will have to do some hard programming by combining the 0-1
binomial part with a continuous distribution on the second part of the
data..and I guess the easiest is to do this in MCMC. Perhaps the Gamma
distribution can be used? You would have to adjust all likelihood equations
as Gamma doesn't allow for zeros. But perhaps another continuous
distribution is more appropriate...depends on your data.


Alain Zuur


-- 
View this message in context: 
http://www.nabble.com/Zinb-for-Non-interger-data-tp24550044p24568326.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.