GeneralizedLinearModelFit and offsert for poisson regression
- To: mathgroup at smc.vnet.net
- Subject: [mg112975] GeneralizedLinearModelFit and offsert for poisson regression
- From: Ester Vilaprinyó <evilaprinyo at cmb.udl.cat>
- Date: Sat, 9 Oct 2010 06:33:13 -0400 (EDT)
Hello, I would like to solve a poisson regression with the GeneralizedLinearModelFit function. I have a matrix with the following form: {{x11,x12, x13, y1}, {x21,x22, x23, y2}, ... } The GeneralizedLinearModelFit for an exponential family Poisson will return e^(b0+b1 f1+ b2 f2+ b3 f3) Can I fix that b3=1? In my case y refers to death counts and x3 to population. In other programs such as Stata this would be solved by offset(x3). I tried to solve this using LinearOffsetFunction but I did not succeed with the following steps: 1) created a new matrix for data = {{x11,x12, y1},{x21,x22, y2},...}. 2) Create a function that will return the offset for each input f[x1_,x2_]:=x3 3) GeneralizedLinearModelFit[data,{x1,x2},{x1,x2},ExponentialFaily->"Poisson", LinearOffsetFunction->(f[#1,#2]&)]. Why it does not work? Thanks!