Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

New answers tagged

2

That isn't how poisson regression works. The link function for poisson regression is the log, so if you did something like x<-runif(100) eta<- 5*x lam<- exp(eta) y<-rpois(length(lam), lam) model<- glm(y~x, family = 'poisson') Then you would recover the proper estimates for the coefficient of x and the intercept. You could however recover ...


5

The default link function is the log function for Poisson, this means: $$\mathbb{E}[y]=\exp\left(\log(5)+\log(x)\right)$$ If you specify your glm model as y ~ log(x) then you should recover "1" as the coefficient and "log(5)" as the intercept


1

I believe the issue is coming in because you are representing events as rates where you have 0 events. Let's walk through how the offset is added (following the notation from the linked answer): A poisson regression of the form: $log(\mu_x) = \beta_0 + \beta_1x$ is adjusted for different measurement times by correcting the expected counts ($\mu_x$) for the ...


0

Yes it can and you can encode it using an indicator variable. Basically you have a variable that is 1 when the data point is in a certain category and 0 if it is not. Wikipedia provides a nice explanation and example: https://en.wikipedia.org/wiki/Dummy_variable_(statistics) For a more specific example/elaboration please see here: https://newonlinecourses....


0

Yes, they can be categorical ... as in all linear and generalized linear models. In fact, you can continue generalizing/extending the family of regression models, and it will still be true. As long as your model uses a matrix of predictor variables, all the coding trick you have learnt for usual linear regression can be applied. You can represent categorical ...


Top 50 recent answers are included