[R] glm: modelling zeros as binary and non-zeroes as coming from a continuous distribution
Hello, I'd like to implement a regression model for extremely zero-inflated continuous data using a conditional approach, whereby zeroes are modelled as coming from a binary distribution, while non-zero values are modelled as log-normal. So far, I've come across two solutions for this: one, in R, is described in the book by Gelman & Hill (http://www.amazon.com/dp/052168689X), where they just model zeros and non-zeros separately and then bring them together by simulation. I can do this, but it makes it difficult to assess the significance of regression coefficients wrt to zero and each other. Another solution I have been pointed at is in SAS: http://listserv.uga.edu/cgi-bin/wa?A2=ind0805A&L=sas-l&P=R20779, where they use NLMIXED (with only fixed effects) to specify their own log-likelihood function. I'm wondering if there's any way to do the same in R (lme can't deal with this, as far as I'm aware). Finally, I'm wondering whether anyone has experience with the COZIGAM package - does it do something like this? Many thanks, Mikhail __ 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] Convert SAS NLMIXED code for zero-inflated gamma regression to R
I'm trying to run a zero-inflated regression for a continuous response variable in R. I'm aware of a gamlss implementation, but I'd really like to try out this algorithm by Dale McLerran that is conceptually a bit more straightforward. Unfortunately, the code is in SAS and I'm not sure how to re-write it for something like nlme (if at all possible - with conditions etc). Does anyone know both languages enough to try translating it? Would very much appreciate your help! The code is as follows: proc nlmixed data=mydata; parms b0_f=0 b1_f=0 b0_h=0 b1_h=0 log_theta=0; eta_f = b0_f + b1_f*x1 ; p_yEQ0 = 1 / (1 + exp(-eta_f)); eta_h = b0_h + b1_h*x1; mu= exp(eta_h); theta = exp(log_theta); r = mu/theta; if y=0 then ll = log(p_yEQ0); else ll = log(1 - p_yEQ0) - lgamma(theta) + (theta-1)*log(y) - theta*log(r) - y/r; model y ~ general(ll); predict (1 - p_yEQ0)*mu out=expect_zig; predict r out=shape; estimate "scale" theta; run; From: http://listserv.uga.edu/cgi-bin/wa?A2=ind0805A&L=sas-l&P=R20779 Best, Mikhail PS. I cross-posted this to stackoverflow under R and SAS - apologies if you're reading this twice... == Mikhail Spivakov, PhD European Bioinformatics Institute -- View this message in context: http://r.789695.n4.nabble.com/Convert-SAS-NLMIXED-code-for-zero-inflated-gamma-regression-to-R-tp3813226p3813226.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.