Modality Test

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Modality Test

Amin W. Mugera

Dear Readers:

I have two issues in nonparametric statistical analysis that i need
help:

First, does R have a package that can implement the multimodality test,
e.g., the Silverman test, DIP test, MAP test or Runt test. I have seen
an earlier thread (sometime in 2003) where someone was trying to write
a code for the Silverman test of multimodality. Is there any other
tests that can enable me to know how many modes are in a distribution?

Second, i would like to test whether two distributions are equal. Does R
have a  package than can implement the Li (1996) test of the equality
of two distributions? Is there any other test i can use rather than the
Li test?

Thank you in advance for your help.

Amin Mugera
Graduate Student
AgEcon Dept. Kansas State University

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Modality Test

RKoenker
the diptest package, perhaps?


url:    www.econ.uiuc.edu/~roger            Roger Koenker
email    [hidden email]            Department of Economics
vox:     217-333-4558                University of Illinois
fax:       217-244-6678                Champaign, IL 61820



On Sep 9, 2008, at 11:23 AM, Amin W. Mugera wrote:

>
> Dear Readers:
>
> I have two issues in nonparametric statistical analysis that i need
> help:
>
> First, does R have a package that can implement the multimodality  
> test,
> e.g., the Silverman test, DIP test, MAP test or Runt test. I have seen
> an earlier thread (sometime in 2003) where someone was trying to write
> a code for the Silverman test of multimodality. Is there any other
> tests that can enable me to know how many modes are in a distribution?
>
> Second, i would like to test whether two distributions are equal.  
> Does R
> have a  package than can implement the Li (1996) test of the equality
> of two distributions? Is there any other test i can use rather than  
> the
> Li test?
>
> Thank you in advance for your help.
>
> Amin Mugera
> Graduate Student
> AgEcon Dept. Kansas State University
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Modality Test

Mark Difford
In reply to this post by Amin W. Mugera
Hi Amin,

>> First, does R have a package that can implement the multimodality test,
>> e.g., the Silverman test, DIP test, MAP test or Runt test.

Jeremy Tantrum (a Ph.D. student of Werner Steutzle's, c. 2003/04) did some work on this. There is some useful code on Steutzle's website:

http://www.stat.washington.edu/wxs/Stat593-s03/Code/jeremy-unimodality.R

I used it last year when I was trying to solve the problem of how best to compare lots of density curves (age distributions of 3 spp. of tree euphorbias from about very different 35 sites). In particular I had to ensure that I wasn't creating spurious bimodality at a particular age range when combining sites.

You might find it useful. Feel free to contact me off list if the code has gone, as I think I still have it (somewhere).

Regards, Mark.

Amin W. Mugera wrote
Dear Readers:

I have two issues in nonparametric statistical analysis that i need
help:

First, does R have a package that can implement the multimodality test,
e.g., the Silverman test, DIP test, MAP test or Runt test. I have seen
an earlier thread (sometime in 2003) where someone was trying to write
a code for the Silverman test of multimodality. Is there any other
tests that can enable me to know how many modes are in a distribution?

Second, i would like to test whether two distributions are equal. Does R
have a  package than can implement the Li (1996) test of the equality
of two distributions? Is there any other test i can use rather than the
Li test?

Thank you in advance for your help.

Amin Mugera
Graduate Student
AgEcon Dept. Kansas State University

______________________________________________
R-help@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.
Mark Difford (Ph.D.)
Research Associate
Botany Department
Nelson Mandela Metropolitan University
Port Elizabeth, South Africa
Reply | Threaded
Open this post in threaded view
|

Re: Modality Test

Mark Difford
Whoops! I think that should be Stuetzle --- though I very much doubt that he reads the list.

Mark Difford wrote
Hi Amin,

>> First, does R have a package that can implement the multimodality test,
>> e.g., the Silverman test, DIP test, MAP test or Runt test.

Jeremy Tantrum (a Ph.D. student of Werner Steutzle's, c. 2003/04) did some work on this. There is some useful code on Steutzle's website:

http://www.stat.washington.edu/wxs/Stat593-s03/Code/jeremy-unimodality.R

I used it last year when I was trying to solve the problem of how best to compare lots of density curves (age distributions of 3 spp. of tree euphorbias from about very different 35 sites). In particular I had to ensure that I wasn't creating spurious bimodality at a particular age range when combining sites.

You might find it useful. Feel free to contact me off list if the code has gone, as I think I still have it (somewhere).

Regards, Mark.

Amin W. Mugera wrote
Dear Readers:

I have two issues in nonparametric statistical analysis that i need
help:

First, does R have a package that can implement the multimodality test,
e.g., the Silverman test, DIP test, MAP test or Runt test. I have seen
an earlier thread (sometime in 2003) where someone was trying to write
a code for the Silverman test of multimodality. Is there any other
tests that can enable me to know how many modes are in a distribution?

Second, i would like to test whether two distributions are equal. Does R
have a  package than can implement the Li (1996) test of the equality
of two distributions? Is there any other test i can use rather than the
Li test?

Thank you in advance for your help.

Amin Mugera
Graduate Student
AgEcon Dept. Kansas State University

______________________________________________
R-help@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.
Mark Difford (Ph.D.)
Research Associate
Botany Department
Nelson Mandela Metropolitan University
Port Elizabeth, South Africa
Reply | Threaded
Open this post in threaded view
|

Re: Modality Test

Mark Difford
In reply to this post by Amin W. Mugera
Hi Amin,

And I have just remembered that there is a function called curveRep in Frank Harrell's Hmisc package that might be useful, even if not quite in the channel of your enquiry. curveRep was added to the package after my struggles, so I never used it and so don't know how well it performs (quite well, I would think).

Regards, Mark.

Amin W. Mugera wrote
Dear Readers:

I have two issues in nonparametric statistical analysis that i need
help:

First, does R have a package that can implement the multimodality test,
e.g., the Silverman test, DIP test, MAP test or Runt test. I have seen
an earlier thread (sometime in 2003) where someone was trying to write
a code for the Silverman test of multimodality. Is there any other
tests that can enable me to know how many modes are in a distribution?

Second, i would like to test whether two distributions are equal. Does R
have a  package than can implement the Li (1996) test of the equality
of two distributions? Is there any other test i can use rather than the
Li test?

Thank you in advance for your help.

Amin Mugera
Graduate Student
AgEcon Dept. Kansas State University

______________________________________________
R-help@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.
Mark Difford (Ph.D.)
Research Associate
Botany Department
Nelson Mandela Metropolitan University
Port Elizabeth, South Africa
Reply | Threaded
Open this post in threaded view
|

Re: Modality Test

Bert Gunter
Here is a function that tests for equality of however many distributions as
you like:

equaldist <- function(...){
## ... numeric sample vectors from the possibly different distributions to
be tested
## returns TRUE only if the distributions are the same
FALSE
}

;-)

-- Bert Gunter
Genentech

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On
Behalf Of Mark Difford
Sent: Tuesday, September 09, 2008 1:23 PM
To: [hidden email]
Subject: Re: [R] Modality Test


Hi Amin,

And I have just remembered that there is a function called curveRep in Frank
Harrell's Hmisc package that might be useful, even if not quite in the
channel of your enquiry. curveRep was added to the package after my
struggles, so I never used it and so don't know how well it performs (quite
well, I would think).

Regards, Mark.


Amin W. Mugera wrote:

>
>
> Dear Readers:
>
> I have two issues in nonparametric statistical analysis that i need
> help:
>
> First, does R have a package that can implement the multimodality test,
> e.g., the Silverman test, DIP test, MAP test or Runt test. I have seen
> an earlier thread (sometime in 2003) where someone was trying to write
> a code for the Silverman test of multimodality. Is there any other
> tests that can enable me to know how many modes are in a distribution?
>
> Second, i would like to test whether two distributions are equal. Does R
> have a  package than can implement the Li (1996) test of the equality
> of two distributions? Is there any other test i can use rather than the
> Li test?
>
> Thank you in advance for your help.
>
> Amin Mugera
> Graduate Student
> AgEcon Dept. Kansas State University
>
> ______________________________________________
> [hidden email] 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/Modality-Test-tp19396085p19400426.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
[hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Modality Test

Mark Difford
Hi Bert,

>> ## returns TRUE only if the distributions are the same ...

Thanks for the elegant code. Problem is, the result is elusive, constantly slipping from view and then rolling into the dip. Perhaps it's broken in this version of R (2.7.2.Patched). A fix would therefore be much appreciated, as I may need to use it again in the near future. A little example follows:

##
p1 <- rnorm(100, 10, 5)
p2 <- rnorm(100, 35, 5)
equaldist(p1, p2)
[1] FALSE
equaldist(c(p1,p2), c(p2,p1))
[1] FALSE

plot(density(c(p1, p2)), main="Twin Peaks")
lines(c(p1,p2))
?

Regards, Mark.

Bert Gunter wrote
Here is a function that tests for equality of however many distributions as
you like:

equaldist <- function(...){
## ... numeric sample vectors from the possibly different distributions to
be tested
## returns TRUE only if the distributions are the same
FALSE
}

;-)

-- Bert Gunter
Genentech

-----Original Message-----
From: r-help-bounces@r-project.org [mailto:r-help-bounces@r-project.org] On
Behalf Of Mark Difford
Sent: Tuesday, September 09, 2008 1:23 PM
To: r-help@r-project.org
Subject: Re: [R] Modality Test


Hi Amin,

And I have just remembered that there is a function called curveRep in Frank
Harrell's Hmisc package that might be useful, even if not quite in the
channel of your enquiry. curveRep was added to the package after my
struggles, so I never used it and so don't know how well it performs (quite
well, I would think).

Regards, Mark.


Amin W. Mugera wrote:
>
>
> Dear Readers:
>
> I have two issues in nonparametric statistical analysis that i need
> help:
>
> First, does R have a package that can implement the multimodality test,
> e.g., the Silverman test, DIP test, MAP test or Runt test. I have seen
> an earlier thread (sometime in 2003) where someone was trying to write
> a code for the Silverman test of multimodality. Is there any other
> tests that can enable me to know how many modes are in a distribution?
>
> Second, i would like to test whether two distributions are equal. Does R
> have a  package than can implement the Li (1996) test of the equality
> of two distributions? Is there any other test i can use rather than the
> Li test?
>
> Thank you in advance for your help.
>
> Amin Mugera
> Graduate Student
> AgEcon Dept. Kansas State University
>
> ______________________________________________
> R-help@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/Modality-Test-tp19396085p19400426.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@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@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.
Mark Difford (Ph.D.)
Research Associate
Botany Department
Nelson Mandela Metropolitan University
Port Elizabeth, South Africa