Timeline for R : Calculate a P-value of a random distribution [duplicate]
Current License: CC BY-SA 3.0
11 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 16, 2017 at 16:02 | history | closed | whuber♦ | Duplicate of Calculating p-value using R | |
Jul 15, 2017 at 16:57 | comment | added | Pere | You seem to be trying to perform bootstrap equivalent to a two samples independent t-test. The details in the answer of stats.stackexchange.com/questions/92542/… may be useful. | |
Jul 15, 2017 at 16:55 | comment | added | whuber♦ | Not all problems are well-posed and not all stated solutions are correct. The likeliest explanation in your case is that the problem proposers failed to articulate additional (very strong) assumptions they had in mind. Another possible explanation is that you have not fully or correctly described the problem. It looks like it is trying to get you to implement either a permutation test or a bootstrap test. | |
Jul 15, 2017 at 16:53 | comment | added | Manuel | actually i don't think it's always 1, for the above observations x and y, the problem says that the R program should output the following result : < 2.2e-16 | |
Jul 15, 2017 at 16:51 | comment | added | whuber♦ |
Fair enough. The correct solution, then, is that the p-value is always $1$! Moreover, that's a wonderfully scalable solution, because it can be computed in constant time, and there are exceptionally brief programs that implement it, such as (1) in R .
|
|
Jul 15, 2017 at 16:46 | comment | added | Manuel | well this is and old programming contest, and it states literaly this : We take an observation x and an observation y, we want to know if x and y are distributed with the same distribution, so we consider $H_0$: x and y are distributed with the same distribution and $H_1$: x and y have different distributions. We consider the statistic test mean(x) - mean(y) = 0 means that $H_0$ holds. We want to determine the p-value using the distribution function of mean(x) - mean(y), that means generating random values with Monte-carlo and then using ecdf to generate the distribution function | |
Jul 15, 2017 at 16:38 | comment | added | whuber♦ | Unfortunately, your test statistic is worthless for evaluating that $H_0$, because $H_0$ is not sufficiently specific. That leaves you two choices: either modify $H_0$ or change your test statistic. | |
Jul 15, 2017 at 16:37 | comment | added | Manuel | I have described H0 ! H0 : the two observations have the same distribution. H0 holds when mean(x) = mean(y), and therefore, H1: the two observations x and y doesn't have the same distribution and mean(x) does not equal mean(y) | |
Jul 15, 2017 at 16:32 | comment | added | whuber♦ | The problem is that this test statistic is useless for the purpose and you cannot define a p-value for it unless you make strong assumptions about what the underlying distribution might mean. (In other words, you haven't adequately described $H_0$.) That's because the distribution of this statistic depends not only on the true difference in means, but also on the variances. Since you don't know the variances, you're stuck. Go back to the textbooks and read about the Student $t$ statistic: it solves this problem. | |
Jul 15, 2017 at 16:08 | answer | added | Dan Hicks | timeline score: 0 | |
Jul 15, 2017 at 15:52 | history | asked | Manuel | CC BY-SA 3.0 |