Home > Back-end >  How to change the p_value of a t.test function
How to change the p_value of a t.test function

Time:12-08

  amostra <- rnorm(27, mean = 1.1, 2.8)
  x <- t.test(amostra, mu = 0.3, alternative = "greater")

I have this code, but I am told that I need to test a H0: mu = 0.3 against H0: mu > 0.3, to the significance level of 0.04. I think they mean the p.value, but I have no idea how to change that

CodePudding user response:

There is a conf.level argument, see ?t.test for more details. The default is conf.level = 0.95 which corresponds to alpha = 0.05 since confidence = 1 - alpha. So if you want significance level of 0.04 that corresponds to a conf.level = 0.96

x <- t.test(amostra, mu = 0.3, alternative = "greater",conf.level = 0.96)
  •  Tags:  
  • r
  • Related