| 82 | | === Weighted Normal Regresion === |
| 83 | | |
| 84 | | Is implemented in [source:/tolp/OfficialTolArchiveNetwork/GrzLinModel/WgtNormal.tol GrzLinModel::@WgtNormal] |
| 85 | | There is an example of use in [source:/tolp/OfficialTolArchiveNetwork/GrzLinModel/test/test_0001/test.tol test_0001/test.tol] |
| 86 | | |
| 87 | | In this case we have |
| 88 | | |
| 89 | | * the identity as link function and mean function [[BR]] [[BR]] |
| 90 | | [[LatexEquation( \eta = g\left(\mu\right)= \mu = g^{-1}\left(\eta\right) = \eta)]] [[BR]] [[BR]] |
| 91 | | * the density function has the variance as extra parameter[[BR]] [[BR]] |
| 92 | | [[LatexEquation( f\left(y;\mu,\sigma^{2}\right)=\frac{1}{\sqrt{2\pi\sigma^{2}}}e^{^{-\frac{1}{2}\frac{\left(y-\mu\right)^{2}}{\sigma^{2}}}} )]][[BR]] [[BR]] |
| 93 | | * the density function will be then [[BR]] [[BR]] |
| 94 | | [[LatexEquation( f\left(y;\mu,\sigma^{2}\right)=\frac{1}{\sqrt{2\pi\sigma^{2}}}e^{^{-\frac{1}{2}\frac{\left(y-\mu\right)^{2}}{\sigma^{2}}}} )]][[BR]] [[BR]] |
| 95 | | * the log-density function will be then [[BR]] [[BR]] |
| 96 | | [[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} )]][[BR]] [[BR]] |
| 97 | | * the partial derivatives of log-density function respect to the linear prediction is [[BR]] [[BR]] |
| 98 | | [[LatexEquation( \frac{\partial\ln f}{\partial\eta}=\frac{1}{\sigma^{2}}\left(y-\eta\right) )]] [[BR]] [[BR]] |
| 99 | | [[LatexEquation( \frac{\partial^{2}\ln f}{\partial\eta^{2}}=-\frac{1}{\sigma^{2}} )]] [[BR]] [[BR]] |
| 100 | | |
| | 105 | |
| | 106 | === Extended Regressions === |
| | 107 | |
| | 108 | Under certain circumstances, the optimization and simulation methods used |
| | 109 | over pure exponential family, can be extended to distributions with extra |
| | 110 | parameters than average. |
| | 111 | |
| | 112 | This extra parameters can be simulated in a Gibbs frame by simple alternating |
| | 113 | and incorporating prior information about all them. In MLE optimization we can |
| | 114 | use [http://en.wikipedia.org/wiki/Expectation%E2%80%93maximization_algorithm Expectation–maximization algorithm] |
| | 115 | to take profit of reusing written code. |
| | 116 | |
| | 117 | ==== Weighted Normal Regresion ==== |
| | 118 | |
| | 119 | Is implemented in [source:/tolp/OfficialTolArchiveNetwork/GrzLinModel/WgtNormal.tol GrzLinModel::@WgtNormal] |
| | 120 | There is an example of use in [source:/tolp/OfficialTolArchiveNetwork/GrzLinModel/test/test_0001/test.tol test_0001/test.tol] |
| | 121 | |
| | 122 | In this case we have |
| | 123 | |
| | 124 | * the identity as link function and mean function [[BR]] [[BR]] |
| | 125 | [[LatexEquation( \eta = g\left(\mu\right)= \mu = g^{-1}\left(\eta\right) = \eta)]] [[BR]] [[BR]] |
| | 126 | * the density function has the variance as extra parameter[[BR]] [[BR]] |
| | 127 | [[LatexEquation( f\left(y;\mu,\sigma^{2}\right)=\frac{1}{\sqrt{2\pi\sigma^{2}}}e^{^{-\frac{1}{2}\frac{\left(y-\mu\right)^{2}}{\sigma^{2}}}} )]][[BR]] [[BR]] |
| | 128 | * we can stablish an optional inverse chi-square prior over the variance or even fix it as a known value. |
| | 129 | * the log-density function will be [[BR]] [[BR]] |
| | 130 | [[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} )]][[BR]] [[BR]] |
| | 131 | * the partial derivatives of log-density function respect to the linear prediction is [[BR]] [[BR]] |
| | 132 | [[LatexEquation( \frac{\partial\ln f}{\partial\eta}=\frac{1}{\sigma^{2}}\left(y-\eta\right) )]] [[BR]] [[BR]] |
| | 133 | [[LatexEquation( \frac{\partial^{2}\ln f}{\partial\eta^{2}}=-\frac{1}{\sigma^{2}} )]] [[BR]] [[BR]] |
| | 134 | |
| | 135 | ==== Weighted Zero-Inflated Poisson Regresion ==== |
| | 136 | |
| | 137 | Is implemented in [source:/tolp/OfficialTolArchiveNetwork/GrzLinModel/WgtPoisson.ZeroInflated.tol GrzLinModel::@WgtPoisson.ZeroInflated] |
| | 138 | There is an example of use in [source:/tolp/OfficialTolArchiveNetwork/GrzLinModel/test/test_0004/test.tol test_0004/test.tol] |
| | 139 | |
| | 140 | This a mixture of Bernouilli and Poisson that inflates the probability of zero occurrences in a certain value |
| | 141 | |
| | 142 | [[LatexEquation(\pi\in\left[0,1\right] )]] |
| | 143 | |
| | 144 | that will be called zero inflation and will be an extra parameter used to fit overdispersion. |
| | 145 | |
| | 146 | When [[LatexEquation(\pi=0 )]] we have a Poisson and when [[LatexEquation(\pi=1 )]] it's a Bernouilli. |
| | 147 | |
| | 148 | * the link function is the same than Poisson one[[BR]] [[BR]] |
| | 149 | [[LatexEquation( \eta = g\left(\mu\right)=\ln\left(\mu\right) )]] [[BR]] [[BR]] |
| | 150 | * the mean function is also unchanged [[BR]] [[BR]] |
| | 151 | [[LatexEquation( \mu = g^{-1}\left(\eta\right)=\exp\left(\eta\right) )]] [[BR]] [[BR]] |
| | 152 | * the probability mass function [[BR]] [[BR]] |
| | 153 | [[LatexEquation( f\left(y;\mu,\pi\right)=\begin{cases}\pi+\left(1-\pi\right)e^{-\mu} & \forall y=0\\\left(1-\pi\right)\frac{1}{y!}e^{-\mu}\mu^{y} & \forall y>0\end{cases} )]] [[BR]] [[BR]] |
| | 154 | * and its logarithm will be [[BR]] [[BR]] |
| | 155 | [[LatexEquation( \ln f\left(y;\mu,\pi\right)=\begin{cases}\ln\left(\pi+\left(1-\pi\right)e^{-\mu}\right) & \forall y=0\\\ln\left(1-\pi\right)-\ln\left(\Gamma\left(y+1\right)\right)+y\ln\mu-\mu & \forall y>0\end{cases} )]] [[BR]] [[BR]] |
| | 156 | * the partial derivatives of log-density function respect to the linear prediction are equals than in a pure Poisson [[BR]] [[BR]] |
| | 157 | [[LatexEquation( \frac{\partial\ln f}{\partial\eta}=y-e^{\eta} )]] [[BR]] [[BR]] |
| | 158 | [[LatexEquation( \frac{\partial^{2}\ln f}{\partial\eta^{2}}=-e^{\eta} )]] [[BR]] [[BR]] |
| | 159 | |