---
title: "Ling 201, session 07: means & corrs (class)"
author:
   - name: "[Stefan Th. Gries](https://www.stgries.info)"
     affiliation: "UC Santa Barbara & JLU Giessen"
     orcid: 0000-0002-6497-3958
date: "2027-02-16 12:34:56"
date-format: "DD MMM YYYY HH-mm-ss"
editor: source
format:
   html:
      page-layout: full
      code-fold: false
      code-link: true
      code-copy: true
      code-tools: true
      code-line-numbers: true
      code-overflow: scroll
      number-sections: true
      smooth-scroll: true
      toc: true
      toc-depth: 4
      number-depth: 4
      toc-location: left
      monofont: lucida console
      tbl-cap-location: top
      fig-cap-location: bottom
      fig-width: 5
      fig-height: 5
      fig-format: png
      fig-dpi: 300
      fig-align: center
      embed-resources: true
      include-in-header:
         text: '<link rel="shortcut icon" href="https://www.stgries.info/favicon.ico" type="image/x-icon" />'
execute:
   cache: false
   echo: true
   eval: true
   warning: false
---

```{r prepworkspace}
rm(list=ls(all=TRUE)); library(magrittr)
```

# Exercise 01

Question: We have known for a long time that the frequency of a word is one of several powerful predictors of how quickly people can recognize the word as a word on a screen: more frequent words are recognized faster. We now want to determine whether that's also true for recently collected data on word recognition/reaction times collected for native speakers of English and Spanish when they were shown both English and Spanish words. Load the file [_input/rts.csv](_input/rts.csv) into a data frame `d`. This file contains data from an experimental study on reaction times to words; you can find information about this data set in [_input/rts.r](_input/rts.r). We want to see whether there is a correlation between `ZIPFFREQ` and `RT`; for that correlation, check the assumptions of the correlation you should want to compute and collect those results, but -- for didactic reasons only -- don't act on the assumptions/results even if they turn out to be not met and pretend they're fine. Once you're done, consider briefly the following: ideally, we would want to see whether that frequency effect is observed even if we somehow control for length. (This is an important exercise and data set in the sense that, if you take more stats classes with me, this data set will feature in all of them to develop successively more comprehensive analyses.)

## Hypotheses

The

* dependent/response variables is/are, if any, # replace this with your answers/code;
* independent/predictor variables is/are, if any, # replace this with your answers/code.

What are the hypotheses?

* text hypotheses:
   + H~1~: replace with your answers/code;
   + H~0~: replace with your answers/code;
* statistical hypotheses:
   + H~1~: replace with your answers/code;
   + H~0~: replace with your answers/code.

## Descriptive stats/visualization

We load the data:

```{r exercise01load}
# replace this with your answers/code
```

We do descriptive stuff:

```{r exercise01desc}
# replace this with your answers/code
```

## Statistical testing

```{r exercise01test}
# replace this with your answers/code
```

## Write-up

replace with your answers/code

## Excursus

# Exercise 02

Question: In the same reaction time data, we want to see whether the two speaker groups -- the variable `GROUP`, which distinguished between native speakers of English who were learners of Spanish (*english*) and heritage speakers of Spanish (*heritage*) -- differed in their average reaction times to words. As above, check the assumptions of the test you should want to compute and collect those results, but -- for didactic reasons only -- don't act on the assumptions/results even if they turn out to be not met and pretend they're fine (This is an important exercise and data set in the sense that, if you take more stats classes with me, this data set will feature in all of them to develop successively more comprehensive analyses.)

## Hypotheses

The

* dependent/response variables is/are, if any, # replace this with your answers/code;
* independent/predictor variables is/are, if any, # replace this with your answers/code.

What are the hypotheses?

* text hypotheses:
   + H~1~: replace with your answers/code;
   + H~0~: replace with your answers/code;
* statistical hypotheses:
   + H~1~: replace with your answers/code;
   + H~0~: replace with your answers/code.

## Descriptive stats/visualization

```{r exercise02desc1}
# replace this with your answers/code
```

## Statistical testing

```{r exercise02test}
# replace this with your answers/code
```

## Write-up

replace with your answers/code

# Exercise 03

Question: Earlier, we saw in the data from [_input/partplacement.csv](_input/partplacement.csv) (see [_input/partplacement.r](_input/partplacement.r)) that the distributions of the lengths of the DOs of the verb-particle constructions differ across the two constructions (using the Kolmogorov-Smirnov test). Then, we followed that up with a test of whether the dispersions of the lengths of the DOs of the verb-particle constructions differ across the two constructions (using the Fligner-Killeen test). You now want to also test whether there is also a difference in the central tendency between the DO lengths in the two constructions. (That, too, could be explainable with processing considerations along the lines of short-before-long (since most particles are just one word or syllable long).)

## Hypotheses

The

* dependent/response variables is/are, if any, # replace this with your answers/code;
* independent/predictor variables is/are, if any, # replace this with your answers/code.

What are the hypotheses?

* text hypotheses:
   + H~1~: replace with your answers/code;
   + H~0~: replace with your answers/code;
* statistical hypotheses:
   + H~1~: replace with your answers/code;
   + H~0~: replace with your answers/code.

## Descriptive stats/visualization

We load the data:

```{r exercise03load}
# replace this with your answers/code
```

We first describe the data:

```{r exercise03desc}
# replace this with your answers/code
```

## Statistical testing

```{r exercise03test}
# replace this with your answers/code
```

## Write-up

replace with your answers/code

## Excursus

# Exercise 04

Question: Does a particular grammar exercise help improve the performance of second language learners. 10 learners do a grammar test and you note their numbers of correct answers. Then, the learners first do the grammar exercise you want to test and then participate in a second test (with the same number of questions). Again, you note the numbers of correct responses, hoping and expecting that the exercise leads to a better performance.

## Hypotheses

The

* dependent/response variables is/are, if any, # replace this with your answers/code;
* independent/predictor variables is/are, if any, # replace this with your answers/code.

What are the hypotheses?

* text hypotheses:
   + H~1~: replace with your answers/code;
   + H~0~: replace with your answers/code;
* statistical hypotheses:
   + H~1~: replace with your answers/code;
   + H~0~: replace with your answers/code.

## Descriptive stats/visualization

The data are in [_input/grmtest.csv](_input/grmtest.csv), with their explanation in [_input/grmtest.r](_input/grmtest.r); we load them from there:

```{r exercise04load}
# replace this with your answers/code
```

Here, some prep is necessary -- you see why?

```{r exercise04prepdata}
# replace this with your answers/code
```

Then we describe the data:

```{r exercise04desc}
# replace this with your answers/code
```

## Statistical testing

```{r exercise04test}
# replace this with your answers/code
```

## Write-up

replace with your answers/code

## Excursus

# Exercise 05

What does this script exemplify?

```{r exercise05a}
#| code-fold: false
#| fig-width: 5
#| fig-height: 5
rm(list=ls(all=TRUE)); set.seed(12) # clear all memory
x1 <- rnorm(50)  ; y1 <- rnorm(50)
x2 <- rnorm(50)+5; y2 <- rnorm(50)+5
x <- append(x1, x2); y <- append(y1, y2)
plot(y ~ x, type="n"); abline(lm(y ~ x)); grid()
   points(y1 ~ x1, col="#0000FF40", pch=19); abline(lm(y1 ~ x1), col="#0000FF40")
   points(y2 ~ x2, col="#FF000040", pch=19); abline(lm(y2 ~ x2), col="#FF000040")
text(0, 6, "r for the\nblack line=0.88")
```

replace with your answers/code

# Exercise 06

Question: Deane (1987) posited that the choice of the *of*-genitive (e.g., *the speech of the President*) vs. the *s*-genitive (e.g., *the President's speech*) was explainable with regard to the relevant referents' position on an 11-point cognitive-entrenchment hierarchy (from 1 'lowest' to 11 'highest'). Gries (1999) wanted to determine whether this entrenchment hierarchy would also explain the verb-particle construction alternation. He created examples of both constructions that used DOs from all 11 entrenchment levels (yielding 22 factor level combinations). Subjects were then given test sentences representing these factor level combinations and were instructed to rate the acceptability of the test sentences; 60 judgments were collected per factor level combination. The file in [_input/entrenchment.csv](_input/entrenchment.csv) contains the average judgments for each of the 22 combinations resulting from the experiment, see [_input/entrenchment.r](_input/entrenchment.r) for the usual explanations. Based on Deane's work, Gries had the hypotheses listed below; your job here is to test them and interpret the results.

## Hypotheses

The

* dependent/response variables is/are, if any, # replace this with your answers/code;
* independent/predictor variables is/are, if any, # replace this with your answers/code.

Here are the hypotheses:

* text hypotheses for *V_DO_PRT*:
   + H~1~: there is a positive correlation between the degree of entrenchment of the DO and the acceptability of the sentence;
   + H~0~: there is no positive correlation between the degree of entrenchment of the DO and the acceptability of the sentence;
* statistical hypotheses for *V_DO_PRT*:
   + H~1~: some correlation coefficient is >0;
   + H~0~: some correlation coefficient is &le;0.
* text hypotheses for *V_PRT_DO*:
   + H~1~: there is a negative correlation between the degree of entrenchment of the DO and the acceptability of the sentence;
   + H~0~: there is no negative correlation between the degree of entrenchment of the DO and the acceptability of the sentence;
* statistical hypotheses for *V_PRT_DO*:
   + H~1~: some correlation coefficient is <0;
   + H~0~: some correlation coefficient is &ge;0.

## Descriptive stats/visualization

We load the data:

```{r exercise06load}
# replace this with your answers/code
```

We describe the data:

```{r exercise06desc}
# replace this with your answers/code
```

## Statistical testing

```{r exercise06test}
# replace this with your answers/code
```

## Write-up

replace with your answers/code

# Session info

```{r}
sessionInfo()
```
