Poisson generalized linear model with log-link.
Parameters |
Description |
y |
Defines Response vector (frequency count). |
A |
Defines covariates, including the constant vector (if needed). |
Beta |
returns regression parameter estimates. |
BStdErr |
returns regression parameter estimates standard errors. |
Deviance |
returns residual deviance. |
DF |
returns residual degrees of freedom, |
Offset |
Offset (optional). |
YCalc |
Returns calculated values (optional). |
Tol |
Desired precision in calculations. |
MaxIter |
Maximum number of iteratively reweighted iterations in algorithm. |
number of evaluations needed for desired precision.
Performs Poisson generalized linear model with log-link. Poisson regression is often used to analyze count data. It can be used to model the number of occurrences of an event of interest or the rate of occurrence of an event of interest, as a function of some independent variables. In Poisson regression it is assumed that the dependent variable Y, number of occurrences of an event, has a Poisson distribution given the independent variables X1, X2, ...., Xn,
P(Y=k| x1, x2, ..., xn) = Exp[-m] m^k / k!, k=0, 1, 2, ......,
where the log of the mean m is assumed to be a linear function of the independent variables. That is,
log(m) = intercept + b1*X1 +b2*X2 + ....+ b3*Xn,
which implies that m is the exponential function of independent variables,
m = exp(intercept + b1*X1 +b2*X2 + ....+ b3*Xn).
In many situations the rate or incidence of an event needs to be modeled instead of the number of occurrences. For example, suppose that we know the number of occurrences of certain disease by county and we want to find out if frequency of occurrence depends on certain demographic variables and health policy programs also recorded by county. Since more at risk subjects result in more occurrences of the disease, we need to adjust for the number of subjects at risk in each county. For such data, we can write a Poisson regression model in the following form:
log(m) = log(N) + intercept + b1*X1 +b2*X2 + ....+ b3*Xn,
where N is the total number of subjects at risk by county. The logarithm of variable N is used as an offset, that is, a regression variable with a constant coefficient of 1 for each observation. The log of the incidence, log (m / N), is modeled now as a linear function of independent variables.
#include "MtxExpr.hpp" #include "Regress.hpp" #include "Math387.hpp" void __fastcall Example() { sVector y,b,berr; sMatrix A; double dev; int df; y.SetIt(false,OPENARRAY(double,(1,2,3,4))); A.SetIt(4,2,false,OPENARRAY(double,(1,5,2,6,3,7,4,8))); PoissonRegress(y,A,b,berr,dev,df,0.0,NULL,1.0e-8,300); }
Copyright (c) 1999-2025 by Dew Research. All rights reserved.
|
What do you think about this topic? Send feedback!
|