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 proportions

We will use the prop.test R function here for testing the equality of proportions for the count data problems

  1. Load the required dataset with data(UCBAdmissions). For the UCBAdmissions dataset, first obtain the Admitted and Rejected frequencies for both the genders across the six departments with:
    UCBA.Dept <- ftable(UCBAdmissions, row.vars="Dept", col.vars = c("Gender", "Admit"))
  2. Calculate the Admitted proportions for Female across the six departments with:
    p_female <- prop.table(UCBA.Dept[,3:4],margin=1)[,1]

    Check p_female!

  3. Test whether the proportions across the departments for Male matches with Female using the prop.test:
    prop.test(UCBA.Dept[,1:2],p=p_female)

    The proportions are not equal across the Gender as ...

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