ruya - 9 months ago 60

R Question

I want to test the following hypothesis in R using a t-statistic and compute the p-value:

Null Hypothesis : mu <= 50

Alternate : mu > 50

`data = c(52.7, 53.9, 41.7, 71.5, 47.6, 55.1,`

62.2, 56.5, 33.4, 61.8, 54.3, 50.0,

45.3, 63.4, 53.9, 65.5, 66.6, 70.0,

52.4, 38.6, 46.1, 44.4, 60.7, 56.4);

It should be very easy, but I'm not sure how to do it. Thank you for your help!

Answer

If your `H0`

equals: `mu<=50`

the right command is:

```
t.test(data, mu=50, alternative = 'greater')
```

With `alternative`

you define `H1`

. Consequently it is: `H1: mu > 50`

.
The output shows the `p.value`

, mean and `t-value`

.
That's it.

Source (Stackoverflow)