[R] empirical null distribution

Duncan Murdoch murdoch at stats.uwo.ca
Tue Apr 29 14:45:27 CEST 2008


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



More information about the R-help mailing list