---
title: "Practice: Maximum likelihood models"
format: 
  html:
    css: tufte-pset-adapted.css
editor: source
---

::: {.content-visible when-format="html"}

*If you complete this exercise using the Quarto file used to generate this page, you could be able to change the `format:` header above to say `format: pdf`, it will render as a pdf file that includes just the questions and your answers (and not, for example, this text).*

:::

::: {.content-visible when-format="html"}

In this exercise, you will be using data of your choosing to fit a logit model with a continuous explanatory variable (that you will treat as your key explanatory variable) and at least one binary or categorical variable.  

::: 

::::: {.content-visible when-format="pdf"}

```{r}
## dependencies

## open data file

```

:::::

_1.  In 1-2 sentences, describe the dataset that you will be using. [2]_

::::: {.content-visible when-format="pdf"}

YOUR ANSWER HERE

:::::

_2. Using these data, fit your logit model. I will refer to this in what follows as Model 1.[0]_

::: {.content-visible when-format="pdf"}
```{r}
# code here
```
:::


_3. Fit a model that includes all the terms from Model 1 but adds a term for the **square** of your key explanatory variable (we will call this Model 2).  [1]_

::: {.content-visible when-format="pdf"}
```{r}
# code here
```
:::

_4. Make a pleasant-looking table which presents the results of the coefficients from the models fit without your covariate added (called "Model 1") and with your covariate added (called "Model 2"). [5]_  

- **_The bottom of the table should include the Ns for Model 1 and 2 (which should be the same), the log-likelihood, the AIC, and the BIC._**
- _The rows should be given substantive labels._  
- _Standard errors should be placed in parentheses below the coefficients._  
- _Stars should be used to denote significance at the .05 and .001 level, with note below the table indicating this._
- _All coefficients and standard errors should be presented to 4 decimal places, and no more than 4 digits after the decimal place should be presented._
- _If the coefficient values for either your key explanatory variable or (more likely) its square are less than .0005, go back and rescale your continuous variable (by dividing by 10, 100, or 1000 etc.) and refit Models 1 and 2._

::: {.content-visible when-format="pdf"}
```{r}
# code here
```
:::


_5. Looking at the AIC and BIC from the table you made, which model is preferred by these criteria?  [1]_

::::: {.content-visible when-format="pdf"}

YOUR ANSWER HERE

:::::

_6. If AIC and BIC disagree about which model is preferred, the disagreement is that AIC prefers model #2 while BIC prefers model #1.  How do I know this, without even looking at your specific results?  [1]_

::::: {.content-visible when-format="pdf"}

YOUR ANSWER HERE

:::::






