ptfamily | R Documentation |
This function defines a truncated Poisson family for use in Generalized Linear Models (GLMs), where zero values are not allowed. It modifies the Poisson likelihood by excluding zero-count observations.
ptfamily(link = "log")
link |
Character string or a link-glm object specifying the link function. Accepted values are "log", "identity", and "sqrt". |
An object of class "family" that can be used in glm()
.
set.seed(123)
y <- rpois(100, lambda = 3)
y <- y[y > 0] # Truncate zeros
x <- rnorm(length(y))
model <- glm(y ~ x, family = ptfamily())
summary(model)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.