IntroAnalysis:::ma223_setup()
library(learnr)

knitr::opts_chunk$set(echo = FALSE)
learnr::tutorial_options(exercise.cap = "Exercise")

```{css, echo=FALSE} / Solution Functionality / .accordion > input[type="checkbox"] { position: absolute; left: -100vw; }

.accordion .content { overflow-y: hidden; height: 0; transition: height 0.3s ease; }

.accordion > input[type="checkbox"]:checked ~ .content { height: auto; overflow: visible; }

.accordion label { display: block; }

/ Styling /

.accordion { margin-bottom: 1em; }

.accordion > input[type="checkbox"]:checked ~ .content { padding: 15px; border: 1px solid #e8e8e8; border-top: 0; }

.accordion .handle { margin: 0; }

.accordion label { cursor: pointer; font-weight: normal; padding: 15px; }

.accordion label:hover, .accordion label:focus { background: #d8d8d8; }

/ Turning arrow / .accordion .handle label:before { font-family: 'fontawesome'; content: "\f054"; display: inline-block; margin-right: 10px; font-size: .58em; line-height: 1.556em; vertical-align: middle; }

.accordion > input[type="checkbox"]:checked ~ .handle label:before { content: "\f078"; }

.tipbox { padding: 1em 1em 1em 1em; border: 1px solid black; border-radius: 10px; box-shadow: 2px 2px #888888; }

.keyidea { border: 1px solid #54585A; background: #4F758B; color: white; }

.keyidea:before { content: "Key Idea: "; font-weight: bold; }

.tip { background: lightyellow; }

.tip:before { content: "Tip: "; font-weight: bold; }

.title{ color: #800000; background: none; }

.solution { background: #ebebeb; }

h2{ color: white; background-color: #800000; }

h3{ color: #800000; border-bottom: thick solid #696969; }

h4{ color: #800000; }

blockquote { font-size: inherit; padding: 0px 20px; }

## Background
A key component of a healthy sexual relationship is consent.  _Any_ sexual activity that occurs without consent constitutes sexual assault ([Hickman & Muehlenhard, 1999](https://doi.org/10.1080/00224499909551996)).  

  > If you would like examples of sexual consent, please visit the resources at [Planned Parenthood](https://www.plannedparenthood.org/learn/relationships/sexual-consent).  If you have been the victim of sexual assault, reach out to a trusted authority or contact the [National Sexual Assault Hotline](https://www.rainn.org/resources).

[MacDougall, Craig, Goldsmith, and Byers (2022)](https://doi.org/10.3138/cjhs.2021-0057) conducted a study to assess the sexual consent attitudes and behavior of undergraduate students in the US and Canada.  For the purposes of this study, the researchers defined sexual consent as follows:

  > sexual consent: the freely given verbal or non-verbal communication of willingness to engage in a specific sexual activity.

A total of 196 undergraduate students participated in the study.  Of these, 164 indicated they had at least one previous sexual partner.  We have access to a subset of the variables for these 164 participants (`consent`).  In separate questions, participants indicated the percentage of their past sexual encounters in which they had explicitly given/received verbal or nonverbal sexual consent.  This captures the consistency of use of sexual consent.  Responses to these two questions were averaged (`Consent`).


## Basic Terminology
For this series of exercises, suppose researchers are interested in determining if the study provides evidence that, on average, undergraduate college students consistently use verbal or non-verbal consent for more than 75% of sexual encounters.


### Exercise: Population
> For the stated research objective, what is the population of interest?

<section class="accordion tipbox solution">
<input type="checkbox" id="solution1"> 
<h4 class="handle"><label for="solution1">Solution</label></h4>
<div class="content">
The population is undergraduate college students.

<iframe src="https://rose-hulman.hosted.panopto.com/Panopto/Pages/Embed.aspx?id=d1fda6ef-6847-49e7-b1bc-b05f01346e07&autoplay=false&offerviewer=true&showtitle=true&showbrand=true&captions=false&interactivity=all" height="405" width="720" style="border: 1px solid #464646;" allowfullscreen allow="autoplay"></iframe>
</div>
</section>

<div class = "tipbox tip">
When describing the population, be as descriptive as possible based on the context of the problem.
</div>


### Exercise: Sample
> For this study, what is the sample?

<section class="accordion tipbox solution">
<input type="checkbox" id="solution2"> 
<h4 class="handle"><label for="solution2">Solution</label></h4>
<div class="content">
The sample is the 164 college students who answered the question on consent.

<iframe src="https://rose-hulman.hosted.panopto.com/Panopto/Pages/Embed.aspx?id=e0c9fe00-d062-424d-9236-b05f01346e09&autoplay=false&offerviewer=true&showtitle=true&showbrand=true&captions=false&interactivity=all" height="405" width="720" style="border: 1px solid #464646;" allowfullscreen allow="autoplay"></iframe>
</div>
</section>


### Exercise: Variable
> For the stated research objective, what is the (response) variable being recorded for each unit?

<section class="accordion tipbox solution">
<input type="checkbox" id="solution3"> 
<h4 class="handle"><label for="solution3">Solution</label></h4>
<div class="content">
The response is the percentage of sexual encounters for which the participant gave/received verbal or non-verbal consent (the `Consent` column in the dataset).

<iframe src="https://rose-hulman.hosted.panopto.com/Panopto/Pages/Embed.aspx?id=7afda441-e8f8-4588-8177-b05f01346e0a&autoplay=false&offerviewer=true&showtitle=true&showbrand=true&captions=false&interactivity=all" height="405" width="720" style="border: 1px solid #464646;" allowfullscreen allow="autoplay"></iframe>
</div>
</section>


### Exercise: Parameter
> For the stated research objective, what is the (population) parameter of interest?

<section class="accordion tipbox solution">
<input type="checkbox" id="solution4"> 
<h4 class="handle"><label for="solution4">Solution</label></h4>
<div class="content">
The parameter is the average percentage of sexual encounters college students give/receive verbal or non-verbal consent.

<iframe src="https://rose-hulman.hosted.panopto.com/Panopto/Pages/Embed.aspx?id=a60b1c7f-7b41-4256-840d-b05f01346e12&autoplay=false&offerviewer=true&showtitle=true&showbrand=true&captions=false&interactivity=all" height="405" width="720" style="border: 1px solid #464646;" allowfullscreen allow="autoplay"></iframe>
</div>
</section>

<div class = "tipbox tip">
It is common for students to confuse a parameter and a variable (perhaps due to the use of _parameter_ in other science courses). While the variable is the measurement you record, the _parameter_ is the summary of that variable within the population.  The phrase "population parameter" is sometimes used instead of simply "parameter" to emphasize that it characterizes the variable within the population.
</div>


## Forming a Set of Hypotheses
Recall that researchers are interested in determining if the study provides evidence that, on average, undergraduate college students consistently use verbal or non-verbal consent for more than 75% of sexual encounters.

### Exercise: Hypotheses
> State the null and alternative hypotheses that capture the research objective.

<section class="accordion tipbox solution">
<input type="checkbox" id="solution5"> 
<h4 class="handle"><label for="solution5">Solution</label></h4>
<div class="content">
Let $\theta$ represent the average percent of sexual encounters college students give/receive verbal or non-verbal consent.  We are interested in testing

$$H_0: \theta \geq 75 \qquad \text{vs.} \qquad H_1: \theta > 75$$

<iframe src="https://rose-hulman.hosted.panopto.com/Panopto/Pages/Embed.aspx?id=a116cf3d-8b18-49c9-8740-b05f013479b8&autoplay=false&offerviewer=true&showtitle=true&showbrand=true&captions=false&interactivity=all" height="405" width="720" style="border: 1px solid #464646;" allowfullscreen allow="autoplay"></iframe>
</div>
</section>


## Constructing a Graphic
### Exercise: Graphic
> Using the available data (`consent`, already available in R), construct a histogram summarizing the distribution of the infection risk within the sample.  Describe the graphic.

```r
ggplot()
ggplot(data = consent) +
  aes(x = Consent) +
  labs(y = "Number of Participants",
       x = "Percentage of Sexual Encounters that Included Consent") +
  geom_histogram()
Choosing the `binwidth=` option is a bit of an art form. If you are unsure of an appropriate bin width, leave off this option and the software will choose one appropriately.


reyesem/IntroAnalysis documentation built on March 29, 2025, 3:29 p.m.