[R] How to find statistics like that.
RRoa at fisheries.gov.fk
Thu Nov 10 13:24:17 CET 2005
> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch [SMTP:r-help-bounces at stat.math.ethz.ch] On Behalf Of Adaikalavan Ramasamy
> Sent: Thursday, November 10, 2005 10:31 AM
> To: Duncan Murdoch
> Cc: r-help at stat.math.ethz.ch
> Subject: Re: [R] How to find statistics like that.
> If my usage is wrong please correct me. Thank you.
> Here are my reason :
> 1. p-value is a (cumulative) probability and always ranges from 0 to 1.
> A test statistic depending on its definition can wider range of possible
> 2. A test statistics is one that is calculated from the data without the
> need of assuming a null distribution. Whereas to calculate p-values, you
> need to assume a null distribution or estimate it empirically using
> permutation techniques.
> 3. The directionality of a test statistics may be ignored. For example a
> t-statistics of -5 and 5 are equally interesting in a two-sided testing.
> But the smaller the p-value, more evidence against the null hypothesis.
> Regards, Adai
A statistic is any real-valued or vector-valued function whose
domain includes the sample space of a random sample. The
p-value is a real-valued function and its domain includes the
sample space of a random sample. The p-value has a sampling
distribution. The code below, found with Google ("sampling distribution
of the p-value" "R command") shows the sampling
distribution of the p-value for a t-test of a mean when the null hypothesis
draws<-matrix(rnorm(n.draw * n, mu, sqrt(pop.var)), n)
get.p.value<-function(x) t.test(x, mu = mu)$p.value
pvalues<-apply(draws, 2, get.p.value)
sum(pvalues <= alpha)
More information about the R-help