[R] back transforming output from negative binomial

2008-10-02 Thread Adaikalavan Ramasamy

Dear all,

I used the glm.nb with the default values from the MASS package to run a 
negative binomial regression. Here is a simple example:



   set.seed(123)
   y - c( rep(0, 30), rpois(70, lambda=2) )
   smoke  - factor( sample( c(NO, YES), 100, replace=T ) )
   height - c( rnorm(30, mean=100, sd=20), rnorm(70, mean=150, sd=20) )

   fit - glm.nb( y ~ smoke + height )
   coef(summary(fit))
  Estimate  Std. Errorz value Pr(|z|)
   (Intercept) -2.34907191 0.537610710 -4.3694664 1.245505e-05
   smokeYES-0.03479730 0.197627539 -0.1760751 8.602349e-01
   height   0.01942373 0.003527538  5.5063142 3.664243e-08


The question now is how do I report the results, say, for height? Do I 
simply take the anti logs. i.e. 1.019613 = exp(0.019423) ?


I have seen one paper where they report using anti log base 10 instead 
of natural base but they use STATA though.


Please kindly advise. Thank you.

Regards, Adai

__
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.


Re: [R] back transforming output from negative binomial

2008-10-02 Thread Ben Bolker
Adaikalavan Ramasamy a.ramasamy at imperial.ac.uk writes:

 
 Dear all,
 
 I used the glm.nb with the default values from the MASS package to run a 
 negative binomial regression. Here is a simple example:
[snip -- thanks for the example!]
 The question now is how do I report the results, say, for height? Do I 
 simply take the anti logs. i.e. 1.019613 = exp(0.019423) ?
 
 I have seen one paper where they report using anti log base 10 instead 
 of natural base but they use STATA though.
 

  Yes, exactly. If you look at ?glm.nb you
will see that it uses a log link function, and therefore
you should exponentiate (anti-log) to back-transform.
Natural, not base-10 logs, are used.
Don't forget that back-transforming standard errors
by themselves is meaningless, you have to back-transform
lower and upper confidence limits ...

  Ben Bolker

__
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.


Re: [R] back transforming output from negative binomial

2008-10-02 Thread Ben Bolker
Adaikalavan Ramasamy wrote:
 Ben, fantastic. Thank you for confirming it.
 
 One more question. What do you call the back transformed variable?
 
 In my domain, people use something called the ratio of mean but I am not
 sure if it is the same. I am not what the ratio is between.

  It depends.  For the intercept, the back-transformed parameter
is essentially the geometric mean of the baseline group (assuming
you're using treatment contrasts).  For factors, the back-transf
parameters are the ratios between the means of observations at one
factor level and the mean at the baseline level.  For continuous
covariates, it's the proportional increase per unit of increase
in the covariate.

 
 Regards, Adai
 
 
 
 Ben Bolker wrote:
 Adaikalavan Ramasamy a.ramasamy at imperial.ac.uk writes:

 Dear all,

 I used the glm.nb with the default values from the MASS package to
 run a negative binomial regression. Here is a simple example:
 [snip -- thanks for the example!]
 The question now is how do I report the results, say, for height? Do
 I simply take the anti logs. i.e. 1.019613 = exp(0.019423) ?

 I have seen one paper where they report using anti log base 10
 instead of natural base but they use STATA though.


   Yes, exactly. If you look at ?glm.nb you
 will see that it uses a log link function, and therefore
 you should exponentiate (anti-log) to back-transform.
 Natural, not base-10 logs, are used.
 Don't forget that back-transforming standard errors
 by themselves is meaningless, you have to back-transform
 lower and upper confidence limits ...

   Ben Bolker

 __
 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.

__
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.