Learn R Programming

PRIST (version 0.925)

zlm: Convenience function for running a zero-inflated regression

Description

Fits a hurdle model on zero-inflated continuous data in which the zero process is modeled as a logistic regression and (conditional on the the response being >0), the continuous process is Gaussian, ie, a linear regression.

Usage

zlm(formula, data, method = "glm", silent = TRUE, ...)

Arguments

formula

model formula

data

a data.frame, list, environment or SingleCellAssay in which formula is evaluated

method

one of 'glm' or 'glmer'. See SingleCellAssay:::methodDict for other possibilities.

silent

if TRUE suppress common errors from fitting continuous part

...

passed to fit, and eventually to the linear model fitting function

Value

list with "disc"rete part and "cont"inuous part

See Also

GLMlike, LMERlike

Examples

Run this code
# NOT RUN {
data<- data.frame(x=rnorm(500), z=rbinom(500, 1, .3))
logit.y <- with(data, x*2 + z*2); mu.y <- with(data, 10+10*x+10*z + rnorm(500))
y <- (runif(500)<exp(logit.y)/(1+exp(logit.y)))*1
y[y>0] <- mu.y[y>0]
data$y <- y
fit <- zlm(y ~ x+z, data)
summary.glm(fit$disc)
summary.glm(fit$cont)
# }

Run the code above in your browser using DataLab