I've written a program that computes some statistic and its covariance matrix via bootstrap. I wish to report the so-called "empirical p-value" (or "percentile bootstrap"?), which I understand corresponds to the probability of getting something more extreme than what was observed. In other words, count the number of values that are greater than or equal to the observed value, and divide by the number of values. In R (which we can think of as pseudocode) it would be something like:
where B is the vector of bootstrap estimates and coef is the estimated coefficient.
My questions are:
Code:
pval = (1+sum(B >= coef))/(N+1)
My questions are:
- Does this methodology make sense?
- How can I compute this conditional count in Stata (or Mata)? I couldn't find any function that lets me count the number of elements in a vector that satisfy certain condition.
Comment