Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: calculate maximum density of normal distribuion
From
Nick Cox <[email protected]>
To
"[email protected]" <[email protected]>
Subject
Re: st: calculate maximum density of normal distribuion
Date
Fri, 22 Nov 2013 15:48:32 +0000
OK. You need to use instead -scatteri- with a -recast()- option,
twoway function normalden(x), range(-4 4)
|| function normalden(x, 2, 2), range(-4 4)
|| scatteri 0 0 `=normalden(0)' 0, recast(line)
|| scatteri 0 2 `=normalden(0)/2' 2, recast(line)
Nick
[email protected]
On 22 November 2013 15:36, Nick Bornschein <[email protected]> wrote:
> I want to end the xline at the peak of the distribution curve, xline without
> any maximum just draws a line higher than the distributions maximum.
>
>
>
> Am 22.11.13 16:34, schrieb Nick Cox:
>
>> If you know the mean, that fixes the position of the maximum; why do
>> you need any other information?
>> Nick
>> [email protected]
>>
>>
>> On 22 November 2013 15:32, Nick Bornschein <[email protected]>
>> wrote:
>>>
>>> Thanks, that worked!!
>>>
>>> And now is the question: can I tell the xline (which is the mean) to end
>>> at
>>> the maximum point somehow?
>>>
>>>
>>>
>>> Am 22.11.13 16:29, schrieb Maarten Buis:
>>>
>>>> The mean won't do anything for the maximum, but the maximum is a
>>>> function of the standard deviation. It has to be otherwise the it
>>>> would not integrate to 1. So -normalden(0,$sd2)- will give you the
>>>> maximum.
>>>>
>>>> -- Maarten
>>>>
>>>>
>>>> On Fri, Nov 22, 2013 at 4:23 PM, Nick Bornschein
>>>> <[email protected]> wrote:
>>>>>
>>>>>
>>>>> Well, no.
>>>>>
>>>>> The maximum density of a normal distribution of mean = 1 and sd = 2 is
>>>>> around 0.2 (looking at the graph) and with mean = 5 and sd = 3 it's
>>>>> around
>>>>> 1.125...so it's not always the same when I change the given mean and
>>>>> sd.
>>>>>
>>>>>
>>>>> Am 22.11.13 16:12, schrieb Nick Cox:
>>>>>>
>>>>>>
>>>>>>
>>>>>> That density is a constant, namely
>>>>>>
>>>>>> . di normalden(0)
>>>>>> .39894228
>>>>>>
>>>>>> Whatever mean a normal has just shifts the distribution left or right,
>>>>>> so makes no difference to what the peak density is; hence without loss
>>>>>> of generality we can focus on mean 0.
>>>>>>
>>>>>> Whatever SD a normal has, 0/SD is still 0.
>>>>>>
>>>>>> Correct me if I'm wrong....
>>>>>> Nick
>>>>>> [email protected]
>>>>>>
>>>>>>
>>>>>> On 22 November 2013 15:00, Nick Bornschein <[email protected]>
>>>>>> wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Hello,
>>>>>>>
>>>>>>> I'm calculating a normal distribution with:
>>>>>>>
>>>>>>> set obs 10000
>>>>>>> set seed 2211
>>>>>>> gen normal2 = rnormal($mean2, $sd2)
>>>>>>>
>>>>>>> by given mean and sd which I define via global macro.
>>>>>>>
>>>>>>> Is it possible to calculate the maximum density at the mean point?
>>>>>>> And more interesting: is it possible to define "xline" until a given
>>>>>>> point
>>>>>>> at the y axis (the maximum density as you can imagine) because I want
>>>>>>> to
>>>>>>> add
>>>>>>> the mean line with going higher than the maximum density?
>>>>>>>
>>>>>>> Best
>>>>>>> -Nick
>>>>>>> *
>>>>>>> * 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/
>>>>>>
>>>>> *
>>>>> * 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/
>>
>> *
>> * 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/
*
* 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/