Hi,
I'm facing two difficulties...
*The first one:* I'm trying to estimate a survey weighted Gamma Regression
with log link, but I found out that Zelig inform just the results for the
inverse link. Adding "family=Gamma(link=log)" does not work. See the
example below:
install.packages("Zelig")
require(Zelig)
#Loading data
data(api, package = "survey")
# Gamma inverse
z.inverse <- zelig(api00 ~ meals + yr.rnd + as.factor(awards), model =
"gamma.survey",
weights = ~pw, data = apistrat, family=Gamma(link=inverse))
# Gamma log
z.log <- zelig(api00 ~ meals + yr.rnd + as.factor(awards), model =
"gamma.survey",
weights = ~pw, data = apistrat, family=Gamma(link=log))
#comparison
coefficients(z.inverse) == coefficients(z.log) *#inverse-link and log-link
coefficients must be different, but they are not*
* (Intercept) meals yr.rndYes
as.factor(awards)Yes *
* TRUE TRUE TRUE
TRUE *
#########################
g.inverse <- glm(api00 ~ meals + yr.rnd + as.factor(awards),
weights = pw, data = apistrat,
family=Gamma(link="inverse"))
g.log <- glm(api00 ~ meals + yr.rnd + as.factor(awards),
weights = pw, data = apistrat, family=Gamma(link="log"))
#comparison
coefficients(g.inverse) == coefficients(g.log) *#glm brings the correct
results*
* (Intercept) meals yr.rndYes
as.factor(awards)Yes *
* FALSE FALSE FALSE
FALSE *
*The second one:* I'm not getting the output for setx in any model! Not
even for "model='ls' "
# In the example above:
meals_seq=seq(from=1,to=30,by=1)
setx(z.inverse, meals=meals_seq)
*Call:*
*NULL*
*Model name = *
*Formula = NULL*
*Complete data.frame:*
*NULL*
*Model Matrix (Design Matrix):*
*NULL*
I'm using R 3.0.2 and Zelig 4.2-1. Rolling back to Zelig 3.5.4 is not worth
in this case... setx works fine in that version, but "gamma.survey" does
not.
thanks in advance,
Rogério J Barbosa
Universidade de São Paulo, Brazil
Show replies by date