Sunday 15 August 2010

r - Calculating p-value using non-parametric bootstrap -


Suppose I have been given a sample, x My professor says that non-parametric bootstrap. I mean adjusting the sample by doing this:

Adjust X = X - mean (x) + mu_not

Then he asks adjustedX to bootstrap, and it returns back is. After receiving the list sample, the P-value can be calculated as the proportion of the bootstrap sample, which means that the sample is less than the sample.

I have simulated it in R, but I am not getting anything right with P-value. Here is my R function:

  pvalue = function (samples, mu_not) {X.boot = X - mean (X) + Mu_not bootstrap = sapply (1: Returns (meaning (mu_net and lieutenant); bootstrap)}}  Code>  

What am I doing wrong? Thank you

For the empty hypothesis mentioned in the comments, you be: u & gt; = U.not This should work:

  pvalue = function (samples, mu_not) {X.boot = Xbootstrap = sapply (1: samples, tasks (A ) {Single = Return (Mean (Single))} Returns (Mean (mu_not & lt; bootstrap))}  
/ html>

No comments:

Post a Comment