Re: [R] is there a function to find the quantile of the mean of a vector?

2010-06-19 Thread J. R. M. Hosking
David LeBauer wrote: Jorge, Thanks for your help. which.min() on the sorted vector divided by the vector length gave me the value I was looking for (I was looking for the probability p(mean(x) | x)): x - runif(1000) x.sort - sort(x) x.length - length(x) x.mean - mean(x) p.mean -

Re: [R] is there a function to find the quantile of the mean of a vector?

2010-06-18 Thread David LeBauer
Jorge, Thanks for your help. which.min() on the sorted vector divided by the vector length gave me the value I was looking for (I was looking for the probability p(mean(x) | x)): x - runif(1000) x.sort - sort(x) x.length - length(x) x.mean - mean(x) p.mean - which.min((x.sort - x.mean)^2) /

[R] is there a function to find the quantile of the mean of a vector?

2010-06-17 Thread David LeBauer
Hello, I am interested in finding the quantile of the mean of a vector, something analogous to using the pnorm(), but for an mcmc chain instead of a distribution with known parameters. One approach would be to write a function that finds the index of x_i that minimizes (x-mean(x))^2 I suspect

Re: [R] is there a function to find the quantile of the mean of a vector?

2010-06-17 Thread Jorge Ivan Velez
Hi David, You might try: set.seed(1) x - runif(10, 3, 7) x [1] 4.062035 4.488496 5.291413 6.632831 3.806728 6.593559 6.778701 5.643191 5.516456 3.247145 (x-mean(x))^2 [1] 1.308783661 0.514892188 0.007285983 2.035688832 1.958118177 1.925165288 2.473214156 [8] 0.191087609 0.096348590