Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: gamma


From   Jason Rosenberg <RSNJAS002@myuct.ac.za>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   RE: st: gamma
Date   Mon, 15 Oct 2012 09:47:51 +0000

Sorry to continue this thread,

but I read the help function guide and help lngamma(), but I still get different results for the gamma function from that of RGui(32-bit) as in:

I type this in stata:
di lngamma(3/4)

and get:
.20328095

but in R I get gamma(3/4)=1.225417

I've tried digamma() and trigamma() in stata just to see and they of course also give me different results.
any advice? I am modeling equations and it would be very helpful not to jump in between R and stata

Also I'm sure the one R is evaluating is the correct one for my purposes.

________________________________________
From: owner-statalist@hsphsun2.harvard.edu [owner-statalist@hsphsun2.harvard.edu] on behalf of Nick Cox [njcoxstata@gmail.com]
Sent: Thursday, October 11, 2012 12:57 PM
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: gamma

Absolutely correct, but not what I recommended. Functions are
documented under -help functions-. Another trick is that

help gamma()

would get you to the help for gamma() if it existed, but it doesn't.

help lngamma()

will help. If you don't know the function name already, this is no
use, which is why I recommended -help functions-, which gets you
started.

Functions and commands in Stata are quite different families, whatever
the terminology elsewhere.

Look at -twoway function- for curve-drawing.

Nick

On Thu, Oct 11, 2012 at 1:45 PM, Jason Rosenberg <RSNJAS002@myuct.ac.za> wrote:
> When I type in: help gamma, I get:
>
> Out-of-date command
>     As of Stata 8.0, the cox, weibull[het], lnormal[het], gamma[het], llogist,
>     llogistic[het], ereg[het], and gompertz[het] commands are out of date.
>     The replacement for cox is stcox.
>     The replacement for weibull[het], lnormal[het], gamma[het], llogist,
>     llogistic[het], ereg[het], and gompertz[het] is streg.
> I read through those but to no avail.
>
> In any case I used R to do the gamma part.
> If possible could you tell how to run this for a continuous variable in place of the 6, I did it for discreet variables, as in:
> egen number = seq()
> then:
> gen prob=(v/gamma(alpha/v))*(beta^(2*alpha)/(number+11.2)^(alpha+1))*exp(-(beta^2/(number+11.2))^v)
> but I need a curve instead of a simple scatter plot. If you could direct me to the relevant help files that would suffice..
>
>
> ________________________________________
> From: owner-statalist@hsphsun2.harvard.edu [owner-statalist@hsphsun2.harvard.edu] on behalf of Nick Cox [njcoxstata@gmail.com]
> Sent: Thursday, October 11, 2012 12:31 PM
> To: statalist@hsphsun2.harvard.edu
> Subject: Re: st: gamma
>
> There is no function -gamma()-, largely I suspect because its values
> become very big.
>
> There is a function -lngamma()-, so you would need -exp(lngamma())-.
>
> Almost all of this can be established by looking at the help for -functions-.
>
> Nick
>
> On Thu, Oct 11, 2012 at 1:25 PM, Jason Rosenberg <RSNJAS002@myuct.ac.za> wrote:
>> hi
>> I an attempting to put this equation into stata:
>>
>> gen prob=(v/gamma(alpha/v))*(beta^(2*alpha)/(6+11.2)^(alpha+1))*exp(-(beta^2/(6+11.2))^v)
>> where v, alpha, and beta are predefined my the user
>> and I get :
>> unknown function gamma()
>>
>> Is there another syntax I should know for gamma?
>> ### UNIVERSITY OF CAPE TOWN This e-mail is subject to the UCT ICT policies and e-mail disclaimer published on our website at http://www.uct.ac.za/about/policies/emaildisclaimer/ or obtainable from +27 21 650 9111. This e-mail is intended only for the person(s) to whom it is addressed. If the e-mail has reached you in error, please notify the author. If you are not the intended recipient of the e-mail you may not use, disclose, copy, redirect or print the content. If this e-mail is not related to the business of UCT it is sent by the sender in the sender's individual capacity. ###
>>
>>
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/faqs/resources/statalist-faq/
>> *   http://www.ats.ucla.edu/stat/stata/
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/
> ### UNIVERSITY OF CAPE TOWN This e-mail is subject to the UCT ICT policies and e-mail disclaimer published on our website at http://www.uct.ac.za/about/policies/emaildisclaimer/ or obtainable from +27 21 650 9111. This e-mail is intended only for the person(s) to whom it is addressed. If the e-mail has reached you in error, please notify the author. If you are not the intended recipient of the e-mail you may not use, disclose, copy, redirect or print the content. If this e-mail is not related to the business of UCT it is sent by the sender in the sender's individual capacity. ###
>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/
### UNIVERSITY OF CAPE TOWN This e-mail is subject to the UCT ICT policies and e-mail disclaimer published on our website at http://www.uct.ac.za/about/policies/emaildisclaimer/ or obtainable from +27 21 650 9111. This e-mail is intended only for the person(s) to whom it is addressed. If the e-mail has reached you in error, please notify the author. If you are not the intended recipient of the e-mail you may not use, disclose, copy, redirect or print the content. If this e-mail is not related to the business of UCT it is sent by the sender in the sender's individual capacity. ###


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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