Ben, 
Thank you, it WAS a typo of sorts.

Officially I tried:
> glm(count~md+ms+rf+sg+offset(log(Eff)),    family=poisson,data=DepthHabGen)
> glm(count~md+ms+rf+sg, offset=(log(Eff)),    family=poisson,data=DepthHabGen)
(which of course are the same as eachother)

> glm(count~md+ms+rf+sg, offset=(Eff),    family=poisson,data=DepthHabGen)
> glm(count~md+ms+rf+sg+offset(Eff),    family=poisson,data=DepthHabGen)
(which are also the same between themselves, yet wrong compared to the STATA 
model)

Additionally, given the text you found on stata website, which I am familiar 
with, I also tried:

> glm(count~md+ms+rf+sg, offset=(exp(Eff)),    family=poisson,data=DepthHabGen)

> glm(count~md+ms+rf+sg+offset(exp(Eff)),    family=poisson,data=DepthHabGen)
(which still might be the solution however R issues the following response:
Error: no valid set of coefficients has been found: please supply starting 
value)

Which, according to other help postings might be able to be forced to function. 
 And I quote from 2008 message 
[R] glm error message when using family Gamma(link="inverse")"You might be able 
to calm glm()'s frayed nerves by supplying some decent 
start values as it is asking. Possibly starting with a subset of 
variables, using the coef()s for the subset and setting the others to zero 
when you attempt to fit all together will be enough to push it past its 
sticking point."

I'm not sure how to go about employing this:
Using, coef() will bring up a list of all coeff, which at this point having 
taken the inverse log or exponential of the variable "Eff", are all very large!

(Eff: is a set of real numbers representing the mean of effort in days 1-209, 
for each count 
 

Also, combined with other postings  and I gather it may be possible to use the 
start() or etastart() functions 

>From [R] documentation, Fitting Generalized linear Models

start

starting values for the parameters in the linear predictor.
etastart

starting values for the linear predictor.
Which I don't understand how to do?

Or perhaps change the link? What would be recommended?

Thank you.

> To: r-h...@stat.math.ethz.ch
> From: bbol...@gmail.com
> Date: Tue, 16 Nov 2010 13:16:20 +0000
> Subject: Re: [R] Offset in glm poisson using R vs Exposure in Stata
> 
> Columbine Caroline Waring <caquilegia <at> hotmail.com> writes:
> 
> > I am hoping to find someone who uses both R and program Stata for GLMs.
> [snip]
> > What I have is the code from Stata  and am trying to reproduce the same
> analysis in R - my program of choice.
> > 
> > .         glm count md ms rf sg, family(poisson)
> > exposure(effort) eform
> > 
> > I am lost at the point of finding the equivalent code for 'exposure'. 
> > 
> > Having looked at a few forums and 'googled'. I thought 'offset', used as   
> offset=(log(Eff))   or the
> > equivalent    +offset(log(Eff))   would produce the desired effect.
> > 
> > Incidentally my code was:  
>   glm(Count~md+ms+rf+sg+offset(Eff),family=poisson,data=DepthHabGen)
> > 
> > (Making use of glm{stats})
> > 
> 
>   Based on your discussion above did you mean
> 
> glm(count~md+ms+rf+sg+offset(log(Eff)),
>    family=poisson,data=DepthHabGen)
> 
>  ? is this just a typo ?
> 
> according to http://www.stata.com/help.cgi?glm
> 
>  exposure(varname)         include ln(varname) in model with coefficient
>                                   constrained to 1
>  offset(varname)           include varname in model with coefficient
>                                   constrained to 1
> 
> 
> > However, offset does not seem to be equivalent to 'exposure' in Stata. As
> coefficients and log likelhood
> > estimates differ.
> > 
> > So I asked the following questions:
> > 
> > 1. Do both programs produce the same results without
> > 'exposure' i.e. glm models 
> > 
> > Yes,  log likelihoods and coefficients are the same.
> > 
> > 2. How about using the unintuitive non logged " offset=Eff" ?
> > 
> > Coefficients and log likelihoods still differ.
> 
>   You're not doing anything obviously wrong.  Are you sure your
> "effort" and "Eff" variables are the same, i.e. nothing got mangled
> moving to R?
> 
>   I don't use Stata, perhaps someone else can try.  Posting a small
> reproducible example would be helpful.
> 
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
                                          
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to