O'Reilly logo

R Statistical Application Development by Example Beginner's Guide by Prabhanjan Narayanachar Tattar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – testing two-sample hypotheses

For the problem of testing hypotheses for the means arising from two populations, we will be using the functions z.test and t.test.

  1. As earlier, load the library(PASWR) library.
  2. Carry out the Z-test using z.test and the options x, y, sigma.x, and sigma.y:
    pH_Data <- c(8.30, 8.42, 8.44, 8.32, 8.43, 8.41, 8.42, 
    8.46, 8.37, 8.42)
    pH_New <- c(8.78, 8.85, 8.74, 8.83, 8.82, 8.79, 8.82, 
    8.74, 8.84, 8.78, 8.75, 8.81)
    z.test(x=pH_Data,y=pH_New,sigma.x=sigma.y=0.05,alternative="less")
    The p-value is very small (2.2e-16) indicating that we reject the null hypothesis that Time for action – testing two-sample hypotheses.
  3. For the steel length cut data problem, run ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required