## Planned comparisons between domestic and international bookings

Qn11. Download the file bookflights.csv from the course materials. This file describes a survey in which website visitors books a flight on either Expedia, Orbitz, or Priceline. Whether they booed a domestic or international flight was recorded. The survey response was 1-7 rating for Ease on a Likert-type scale, with “7” being easiest. The research question is which site felt easiest to use overall, and specifically for domestic vs. international bookings. How many subjects took part in this study?

Qn12. Create an interaction plot with Website on the X-axis and International as the traces. How many times, if ay, do the two traces cross? Hint: if you already recoded Ease as an ordinal response, you must use as.numeric when passing it to interaction.plot.

Qn13. Use ordinal logistic regression to examine Ease by Website and International. To the nearest ten-thousandth (four digits), what is the p-value of the website main effect? Hint: Use the MASS library and its polr function with Hess = TRUE to create the ornidal logistic model. Then use the car library and its Anova function with type = 3. Prior to either, set sum-to-zero contrasts for both website and international.

Qn14. Conduct three planned comparisons between domestic and international bookings for each website. Adjust for multiple comparisons using Holm’s sequential Bonferroni procedure. What is the highest p-value from such tests? Hint: use the multcomp and lsmeans libraries and the lsmeans, pairs, and as.glht functions. (The lsm formulation from within glht will not work in this case.) Because we only have three planned pairwise comparisons, use “none” for the multiple comparisons adjustment to avoid correcting for all possible pairwise comparisons. Instead, just find the three planned and as-yet uncorrected p-values and pass them manually to p.adjust with method=”holm”. Since the formulation for simultaneous comparisons is a bit different, we place the code for those aspects of this questions here:

``````Summary(glht(m,lsm(pairwise ~ website * International)), test = adjusted (type = “non”))
``````

Qn15. Which of the following conclusions are supported by the analyses we performed on bookflights.csv?

``````There was a significant main effect of website on Ease
There was a significant main effect of International on Ease
There was significant website*international interaction
Expedia was perceived as significantly easier for booking international flights than domestic
Orbitz was perceived as significantly easier for booking domestic flights than international flights
Priceline was perceived as significantly easier for booking domestic flights than interanion flights.

``````

## Doing Generalized Linear Models - Coursera quiz online

Doing Generalized Linear Models
Qn1. Download the file deviceprefssex.csv from the course materials. This file describes the same study as in our deviceprefs.csv file, but now augmented with a column for sex (M,F). It also still contains a column for disability (1,0). The research question is how preference for either touchpads or trackballs differs by disability status and sex. How many subjects took part in this study?

Qn2. Use binomial regression to examine Pref by Disability and sex. To the nearest ten-thousandth (four digits), what is the p-value f the Disability * Sex interaction? Hint: Create a model with glm using family=binomial. The use the car library and its Anova function with type = 3. Prior to either, set sum-to-zero contrasts for both disability and sex.

Qn3. Multinomial regression generalizes binomial regression to dependent variables with more than two categories, so it can handle just two categories as well. Use multinomial regression to examine Pref by Disability and Sex, To the nearest ten-thousandth (four digits), what is the p-value of Disability * Sez interaction? Hint: use the nnet library and its multinom function, The use the car library and its Anova function with type = 3. Prior to either, set sum-to-zero contrasts for both Disability and Sex.

Qn4. Let us examine whether there was a significant preference for touchpads or trackballs within each Disability Se combination. Conduct such exploration using post hoc binomial tests. Adjust for multiple comparisons using Holm’s sequential Bonferroni procedure. What is the lowest corrected p-value produced by such an exploration? Hint: Conduct four separate tests with binm.test. The four tests correspond to the four combinations of Disability and Sex. For each combination, test the sum of rows preferring “touchpad” against all rows having that same Disability Sex combination. Since there are only two devices, a test for touchpad is implicity a test for trackball, and vice versa.