r - Poisson regression on gravity model -
for university project, trying fit regression model demand number of independent variables. tried include small example, didn't work figure (as new this). instead, see following link view sample of dataset using:
in table, first column indicates country pairs, columns 2 6 independent variables, , final column depedent variable. do, perform regression analysis, assuming data can described gravity equation.
i know people use log-linearisation solve this. however, dealing zeros in data (and don't distort data adding small constants), , assume heteroskedasticity in data, use different method. based on santos 2006 described (in paper "the log of gravity"), use poisson pseudo maximum likelihood estimation.
however, new using r (or statistical software), , cant figure out how in r. can me this? thing i've found far glm commands poisson , quasipoisson used (https://stat.ethz.ch/pipermail/r-help/2010-september/252476.html).
i've searched in documents on glm, don't understand how use glm function solve gravity model? how specify want model in form:
dem = rp^alpha1 * gdpc_o^alpha2 * gdpc_d^alpha3 * pop_o^alpha4....
, use regression solve different alphas?
hard precisely without more detail, but
glm(dem ~ log(rp) + log(gdpc_o) + log(gdpc_d) + log(pop_o), data=your_data, family=quasipoisson(link="log"))
should work reasonably well. intercept log of proportionality constant; other coefficients exponents of respective terms (this works because log link says log(dem) = beta_0 + beta_1*log(rp) + ...
; if exponentiate both sides dem = exp(beta_0) * exp(log(rp)*beta_1) * ...
or dem = c*rp^beta_1*...
ps not necessary, may helpful interpretation scale , center predictor variables.
Comments
Post a Comment