[R] Comparing two pdf resulting from density() and identify where significantly smaller or larger?

David Winsemius dwinsemius at comcast.net
Wed Jul 27 14:09:02 CEST 2011


On Jul 27, 2011, at 5:36 AM, Rainer M Krug wrote:

> Sorry for re-iterating - but are there any suggestions on how I  
> could tackle
> this problem?

You could start by providing an operational definition for "identity  
the areas where d.all is significantly larger then d.co and where it  
is significantly smaller" when presumably working from a perspective  
off not knowing anything about the parent distributions for the random  
draws.  I had no notion of piecewise significance of differences in  
densities and figured you were the the one advancing the notion, so  
you should be defining what you meant. I was expecting one of my  
statistical betters to step in can correct or comment on the  
statistical issues, but that hasn't yet happened, so if you have an  
operational definition, we could try to implement it across the range  
of the two empiric densities.

-- 
David
>
> Thanks,
>
> Rainer
>
> On Tue, Jul 26, 2011 at 2:58 PM, Rainer M Krug <r.m.krug at gmail.com>  
> wrote:
>
>> Hi
>>
>> this might be a little bit off topic, but here it goes: lets assume  
>> I have
>> the following:
>>
>>        set.seed(13)
>>        dat1 <- rnorm(2000, mean=10, sd=10)
>>        dat2 <- rnorm(100,  mean=10, sd=20)
>>        d.all <- density(dat, n=1024)
>>        d.co <-  density(x[[v]], , from=min(d.all$x), to=max(d.all$x),
>> n=1024)
>>        d.diff <- list(
>>                       x = d.all$x,
>>                       y = d.all$y - d.co$y
>>                       )
>>
>>        ylim <- range(c(d.all$y, d.co$y, d.diff$y))
>>        plot(
>>             d.all,
>>             ylim = ylim
>>             )
>>        abline(h=0)
>>        lines(d.co, col="red")
>>        lines(d.diff$x, d.diff$y, col="blue")
>>
>> Now I would like to identify the areas where d.all is significantly  
>> larger
>> then d.co and where it is significantly smaller.
>>
>> What is the easiest approach to do this? At the moment I am not  
>> doing any
>> tests, but I am sure there is a way to determine the ranges  
>> statistically?
>>
>> Thanks,
>>
>> Rainer
>>
>> --
>> Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation  
>> Biology,
>> UCT), Dipl. Phys. (Germany)
>>
>> Centre of Excellence for Invasion Biology
>> Stellenbosch University
>> South Africa
>>
>> Tel :       +33 - (0)9 53 10 27 44
>> Cell:       +33 - (0)6 85 62 59 98
>> Fax (F):       +33 - (0)9 58 10 27 44
>>
>> Fax (D):    +49 - (0)3 21 21 25 22 44
>>
>> email:      Rainer at krugs.de
>>
>> Skype:      RMkrug
>>
>>
>
>
> -- 
> Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation  
> Biology,
> UCT), Dipl. Phys. (Germany)
>
> Centre of Excellence for Invasion Biology
> Stellenbosch University
> South Africa
>
> Tel :       +33 - (0)9 53 10 27 44
> Cell:       +33 - (0)6 85 62 59 98
> Fax (F):       +33 - (0)9 58 10 27 44
>
> Fax (D):    +49 - (0)3 21 21 25 22 44
>
> email:      Rainer at krugs.de
>
> Skype:      RMkrug
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> 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.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list