Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: RE: log to the base 2


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: RE: log to the base 2
Date   Wed, 18 Oct 2006 11:06:50 +0100

The literature you read evidently doesn't
overlap much with mine. I see natural 
logarithms everywhere because of the way 
they link, naturally, to calculus and logs 
base 10 because many people find them convenient. 
Logs base 2 come a long way down. However, 
David Airey has pointed to one large literature
that differs and no doubt there are others. 

Still, who cares much about that different perception? 

If you want to write a program, you'll realise
that the name -log- is already
taken. You could write a program defining an -egen- function 
but I advise a name very different from _glog.ado as 
otherwise confusion at some point is inevitable. However, 
a program won't mean that you can use that name everywhere 
you can use -log()- and for that reason the work-around 
-log(x) / log(2)- is way more versatile. 

Nick 
n.j.cox@durham.ac.uk 

Raphael Fraser
 
> Base 2 is probably the most widely used base in applied statistics.
> One reason is that it makes interpretation of your model so much
> easier. I suspect this has not come up in FAQ because users simply
> calculate the base themselves.
> 
> My idea of a log function would be something like this: log(x, y).
> Which would read, "log of x base y." Not to create a function for
> every base. This is what I was looking for initially.
> 
> I guess it wouldn't hurt if I write a small program.
> 
> Raphael
> 
> On 10/17/06, Nick Cox <n.j.cox@durham.ac.uk> wrote:
> > What matters here is what StataCorp thought when
> > choosing which functions to implement.
> >
> > The point is when to stop. If another base other than
> > e and 10 were to be supplied, it would certainly be base 2.
> > However, I don't think that logs base 2 are especially
> > often needed in statistical work -- if they were this
> > would be an FAQ because many others would have the
> > same question as you -- and as the work-around is easy
> > I guess StataCorp decided to stop short.
> >
> > Nick
> > n.j.cox@durham.ac.uk
> >
> > Raphael Fraser
> >
> > > I thought the logs were so easy to calculate this would 
> be a single
> > > standard function in Stata. I suppose you thought: if 
> they are so easy
> > > to calculate why write a function.
> >
> > > On 10/17/06, Nick Cox <n.j.cox@durham.ac.uk> wrote:
> >
> > > > You hardly need any such function. The recipe
> > > > log(x) / log(2) or log10(x) / log10(2) will suffice.
> > > >
> > > > For example,
> > > >
> > > > . di log(8) / log(2)
> > > > 3
> > > >
> > > > Strictly just one log function is enough, but -log10()-
> > > > is a convenience for those preferring the unnatural.
> >
> > Raphael Fraser
> >
> > > > > I have been trying to find a function that can calculate
> > > the log of a
> > > > > number to base 2. I can't find one. Am I missing
> > > something here or am
> > > > > I not searching hard enough? Can any one help?
> > > > >
> > > > > I see log to base 10 and log to base e but what happen to the
> > > > > other bases?

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index