empirical null distribution

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

empirical null distribution

mad_bassie
I simulated data for the ANOVA-test where the condition of equal variances was not accomplished.
I have three groups:
X<-rnorm(50,30,5)
Y<-rnorm(50,30,10)
Z<-rnorm(50,30,5)
(this is just an example....the variables might still change depending on how clear the results are)

Now I want to construct the empirical null distribution of it.
How do I do this?
Can I make a graph of it?
Could I compare that graph with that of the theoretical null distribution?

Thanks a lot!
Reply | Threaded
Open this post in threaded view
|

Re: empirical null distribution

David Winsemius
mad_bassie <[hidden email]> wrote in
news:[hidden email]:

>
> I simulated data for the ANOVA-test where the condition of equal
> variances was not accomplished.
> I have three groups:
> X<-rnorm(50,30,5)
> Y<-rnorm(50,30,10)
> Z<-rnorm(50,30,5)
> (this is just an example....the variables might still change
> depending on how clear the results are)
>
> Now I want to construct the empirical null distribution of it.

Assuming "it" is a hypothetical shared distribution that X, Y and Z are
possibly all drawn from, then:

?stack

> How do I do this?
> Can I make a graph of it?
> Could I compare that graph with that of the theoretical null
> distribution?

This is looking more and more like homework. Suggest you try some
searches.

--
David Winsemius

______________________________________________
[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: empirical null distribution

mad_bassie
It's not really homework :)
It's just an a little extra I want to explore.
I allready compared the empirical null distribution and the theoritical null distribution by comparing their quantiles. The results are clear... But I just wondered if there isn't any way to make a graph of it...so you don't really need to compare numbers...that the image speaks for itself.
I'm kind of a newbie in "R"...I did learn many things allready but this graphics stuff is kind of complex to me...

Reply | Threaded
Open this post in threaded view
|

Re: empirical null distribution

Duncan Murdoch
On 29/04/2008 4:13 AM, mad_bassie wrote:
> It's not really homework :)
> It's just an a little extra I want to explore.
> I allready compared the empirical null distribution and the theoritical null
> distribution by comparing their quantiles. The results are clear... But I
> just wondered if there isn't any way to make a graph of it...so you don't
> really need to compare numbers...that the image speaks for itself.
> I'm kind of a newbie in "R"...I did learn many things allready but this
> graphics stuff is kind of complex to me...

QQ plots are a natural way to compare distributions.

You didn't say what statistic you are using, but if you are working with
p-values, the theoretical null is probably uniform, so a simple
histogram is useful.

Duncan Murdoch

______________________________________________
[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: empirical null distribution

mad_bassie
I'm using F-distributions :)
I allready found some things...I could plot the qqplot as you say and that gives me clear results.
Allthough I still want a clear graphic and I 'll explain it as good as I can...

I plotted 2 graphics
plot(density(rf(10000,2,49)))
plot(density(disttest))                      

(the "disttest" is a distribution i simulated myself like this:
for(i in 1:100){

   X<-rnorm(50,20,4)
   Y<-rnorm(50,20,5)
   Z<-rnorm(50,20,4)

   vector<-c (X, Y, Z)
   vector2<-rep(c('X','Y','Z'),c(50,50,50))
   data1<-data.frame(waarde=vector, soort = vector2)
   library(mvtnorm)

   library(multcomp)
   data1$soort<-as.factor(data1$soort)

   disttest<-c(disttest,summary(aov(waarde~soort,data=data1))[[1]][1,4])
   }
(I want to compare the theroretical F-distribution with a distribution where the variances are not equal...)

Thos are 2 fine plots but I just can't figure out how to put them together in one graphic...is this possible in R...it would make things much clearer because the window setting are not really equal wich makes it difficult to compare...

Thanks a lot allready!



Reply | Threaded
Open this post in threaded view
|

Re: empirical null distribution

Duncan Murdoch
On 29/04/2008 8:09 AM, mad_bassie wrote:

> I'm using F-distributions :)
> I allready found some things...I could plot the qqplot as you say and that
> gives me clear results.
> Allthough I still want a clear graphic and I 'll explain it as good as I
> can...
>
> I plotted 2 graphics
> plot(density(rf(10000,2,49)))
> plot(density(disttest))                      
>
> (the "disttest" is a distribution i simulated myself like this:
> for(i in 1:100){
>
>    X<-rnorm(50,20,4)
>    Y<-rnorm(50,20,5)
>    Z<-rnorm(50,20,4)
>
>    vector<-c (X, Y, Z)
>    vector2<-rep(c('X','Y','Z'),c(50,50,50))
>    data1<-data.frame(waarde=vector, soort = vector2)
>    library(mvtnorm)
>
>    library(multcomp)
>    data1$soort<-as.factor(data1$soort)
>
>    disttest<-c(disttest,summary(aov(waarde~soort,data=data1))[[1]][1,4])
>    }
> (I want to compare the theroretical F-distribution with a distribution where
> the variances are not equal...)
>
> Thos are 2 fine plots but I just can't figure out how to put them together
> in one graphic...is this possible in R...it would make things much clearer
> because the window setting are not really equal wich makes it difficult to
> compare...

You'd be better off comparing p-values than densities, but you can do
what you're trying by using lines(density(disttest)) instead of calling
plot() again.

Duncan Murdoch

______________________________________________
[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.