[R-sig-eco] Two-sided significant test for null models

Bob O'Hara bohara at senckenberg.de
Tue Jul 23 12:20:01 CEST 2013


On 07/23/2013 12:06 PM, Cayetano Gutiérrez Cánovas wrote:
> Dear all,
>
> I'd like to test the two-side significance of an observed value being
> lower or higher in comparison to a null distribution, but I don't know
> how to build this in R code. Can anybody help me with some code or any R
> function?
>
> Let's say  'null.dist' the null distribution, 'obs' the observed value
> and 'alpha' the probability of Type I error.
> set.seed(10)
> rnorm(999)->null.dist
> obs<-1.5
> alpha<-0.05
pval=mean(obs>null.dist)
min(pval, 1-pval)<0.05

Bob

-- 

Bob O'Hara

Biodiversity and Climate Research Centre
Senckenberganlage 25
D-60325 Frankfurt am Main,
Germany

Tel: +49 69 7542 1863
Mobile: +49 1515 888 5440
WWW:   http://www.bik-f.de/root/index.php?page_id=219
Blog: http://blogs.nature.com/boboh
Journal of Negative Results - EEB: www.jnr-eeb.org



More information about the R-sig-ecology mailing list