[R] Help interpreting density().
rkevinburton at charter.net
rkevinburton at charter.net
Tue Jul 29 10:32:16 CEST 2008
Sorry I tried WikiPedia and only found:
Wikipedia does not have an article with this exact name.
I will try to find some other sources of information.
Kevin
---- Mark Difford <mark_difford at yahoo.co.uk> wrote:
>
Hi Kevin,
>> I still have my original question. How does the output relate to
>> estimating the parameters
>> of a given density? I read that for a gausian kernal:
This isn't the place for such questions: you need to do some _basic_ reading
on the subject so that you begin to understand something about the method
you are messing about with. Basically (very basically) it's a smoothed out
histogram. And you will probably (?) know that a histogram is [still used]
to show you how a set of univariate data (random variable) is distributed.
Perhaps start with http://en.wikipedia.org/wiki/Kernel_density, then go
somewhere else. But since you have access to the web you really should have
found something like this yourself.
Regards, Mark.
rkevinburton wrote:
>
> OK. Thank you for pointing out my mistake.
>
> I still have my original question. How does the output relate to
> estimating the parameters of a given density? I read that for a gausian
> kernal:
>
> bw.nrd0 implements a rule-of-thumb for choosing the bandwidth of a
> Gaussian kernel density estimator. It defaults to 0.9 times the minimum of
> the standard deviation and the interquartile range divided by 1.34 times
> the sample size to the negative one-fifth power (= Silverman's ‘rule of
> thumb’
>
> But how does that relate to say a Poisson distribution or a two-parameter
> distribution like a normal, beta, or binomial distribution?
>
> Thank you.
>
> Kevin
>
> ---- Mark Difford <mark_difford at yahoo.co.uk> wrote:
>>
>> Hi Kevin,
>>
>> >> The documentation indicates that the bw is essentially the sd.
>> >> > d <- density(rnorm(1000))
>>
>> Not so. The documentation states that the following about "bw": "The
>> kernels
>> are scaled such that this is the standard deviation of the smoothing
>> kernel...," which is a very different thing.
>>
>> The default bandwidth used by density is ?bw.nrd0. Read that
>> documentation
>> carefully and all might be clear.
>>
>> HTH, Mark.
>>
>>
>> rkevinburton wrote:
>> >
>> > I issue the following:
>> >
>> >> d <- density(rnorm(1000))
>> >> d
>> >
>> > and get:
>> >
>> > Call:
>> > density.default(x = rnorm(1000))
>> >
>> > Data: rnorm(1000) (1000 obs.); Bandwidth 'bw' = 0.2235
>> >
>> > x y
>> > Min. :-3.5157 Min. :2.416e-05
>> > 1st Qu.:-1.6892 1st Qu.:1.129e-02
>> > Median : 0.1373 Median :7.267e-02
>> > Mean : 0.1373 Mean :1.367e-01
>> > 3rd Qu.: 1.9639 3rd Qu.:2.693e-01
>> > Max. : 3.7904 Max. :4.014e-01
>> >
>> > The documentation indicates that the bw is essentially the sd. Yet I
>> have
>> > specified an sd of 1? How am I to interpret the ranges of the values? x
>> > ranges almost from -4 to +4 and y ranges from 0 to 0.4. The mean x is
>> .1
>> > which isn't too awfully close to what I would expect (0.0). Then there
>> is:
>> >
>> >> d <- density(rpois(1000,0))
>> >> d
>> >
>> > Call:
>> > density.default(x = rpois(1000, 0))
>> >
>> > Data: rpois(1000, 0) (1000 obs.); Bandwidth 'bw' = 0.2261
>> >
>> > x y
>> > Min. :-0.6782 Min. :0.01979
>> > 1st Qu.:-0.3391 1st Qu.:0.14073
>> > Median : 0.0000 Median :0.57178
>> > Mean : 0.0000 Mean :0.73454
>> > 3rd Qu.: 0.3391 3rd Qu.:1.32830
>> > Max. : 0.6782 Max. :1.76436
>> >
>> > Here I am getting the mean that I expect from a Poisson distribuition
>> but
>> > y ranges from 0 to 1.75. Again I am not sure what these numbers mean.
>> How
>> > can I map the output to the standard distirbution description
>> parameters?
>> >
>> > Thank you.
>> >
>> > Kevin
>> >
>> > ______________________________________________
>> > R-help at 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.
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Help-interpreting-density%28%29.-tp18704955p18706154.html
>> Sent from the R help mailing list archive at Nabble.com.
>>
>> ______________________________________________
>> R-help at 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 at 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.
>
>
--
View this message in context: http://www.nabble.com/Help-interpreting-density%28%29.-tp18704955p18707522.html
Sent from the R help mailing list archive at Nabble.com.
______________________________________________
R-help at 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.
More information about the R-help
mailing list