[[PageOutline]] = Package GrzLinModel = Max-likelihood and bayesian estimation of [http://en.wikipedia.org/wiki/Generalized_linear_model generalized linear models]. == Weighted Generalized Regresions == Abstract class [source:/tolp/OfficialTolArchiveNetwork/GrzLinModel/WgtReg.tol GrzLinModel::@WgtReg] is the base to inherit weighted generalized linear regressions as poisson, binomial, normal or any other, given just the scalar link function [[LatexEquation( g )]] and the density function [[LatexEquation( f )]]. In a weighted regression each row of input data has a distinct weight in the likelihood function. For example, it can be very usefull to handle with data extrated from an stratified sample. Let be * [[LatexEquation( X\in\mathbb{R}^{m\times n} )]] the regression input matrix * [[LatexEquation( w\in\mathbb{R}^{m} )]] the vector of weights of each register * [[LatexEquation( y\in\mathbb{R}^{m} )]] the regression output matrix * [[LatexEquation( \beta\in\mathbb{R}^{n} )]] the regression coefficients * [[LatexEquation( \eta=X\beta\in\mathbb{R}^{n} )]] the linear prediction * [[LatexEquation( g )]] the link function * [[LatexEquation( g^{-1} )]] the inverse-link or mean function * [[LatexEquation( f)]] the density function of a distribution of the [http://en.wikipedia.org/wiki/Exponential_family exponential family] Then we purpose that the average of the output is the inverse of the link function applyied to the linear predictor [[LatexEquation( E\left[y\right]=\mu=g^{-1}\left(X\beta\right) )]] The density function becomes as a real valuated function of at least two parameters [[LatexEquation( f\left(y;\mu\right) )]] For each row [[LatexEquation( k=1 \dots n)]] we will know the output [[LatexEquation( y_k )]] and the average [[LatexEquation( \mu_{k}=g^{-1}\left(\eta_{k}\right)=g^{-1}\left(x_{k}\beta\right) )]] Each particular distribution may have its own additional parameters which will be treated as a different Gibbs block. This class also implements these common features * scalar prior information of type normal or uniform, truncated or not in both cases, and * linear constraining inequations over linear parameters [[BR]][[BR]] [[LatexEquation( A \beta \ge a )]] === Weighted Normal Regresion === Is implemented in [source:/tolp/OfficialTolArchiveNetwork/GrzLinModel/WgtNormal.tol GrzLinModel::@WgtNormal] There is a sample of use in [source:/tolp/OfficialTolArchiveNetwork/GrzLinModel/test/test_0001/test.tol test_0001/test.tol] In this case we have * the identity as link function and mean function [[BR]] [[BR]] [[LatexEquation( \eta = g\left(\mu\right)= \mu = g^{-1}\left(\eta\right) = \eta)]] [[BR]] [[BR]] * the log-density function has the variance as extra parameter[[BR]] [[BR]] [[LatexEquation( \ln f\left(y;\mu,\sigma^{2}\right)= -\frac{1}{2}\ln\left(2\pi\sigma^{2}\right)-\frac{1}{2\sigma^{2}}\left(y}-\mu\right)^{2} )]] === Weighted Poisson Regresion === It will be implemented in [source:/tolp/OfficialTolArchiveNetwork/GrzLinModel/WgtPoisson.tol GrzLinModel::@WgtPoisson] but is not available yet. In this case we have * the link function [[BR]] [[BR]] [[LatexEquation( \eta = g\left(\mu\right)=\ln\left(\mu\right) )]] [[BR]] [[BR]] * the mean function [[BR]] [[BR]] [[LatexEquation( \mu = g^{-1}\left(\eta\right)=\exp\left(\eta\right) )]] [[BR]] [[BR]] * the log-probability mass function [[BR]] [[BR]] [[LatexEquation( \ln f\left(y;\mu\right)=-\ln\left(y!\right)+y\ln\left(\mu\right)-\mu = -\ln\left(y!\right)+y\eta-e^{\eta})]] === Weighted Qualitative Regresion === For boolean and qualitative response outputs like logit or probit there is an specialization on package [wiki:OfficialTolArchiveNetworkQltvRespModel QltvRespModel]