---
title: "Problem Set: Logit Model for Binary Outcomes"
format: 
  html:
    css: tufte-pset-adapted.css
editor: source
---


## Practice

::: {.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"}

Here, you will be using the same data and variables that you used in the practice part of the linear probability model problem set.

In that example, you had a binary and a continuous key explanatory variable, and covariates.  We will call the model that includes all these variables the _full_ model, and the variable that includes only the key explanatory variables the _reduced_ model.

::: 

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

```{r}
## dependencies

## open data file

```

:::::

1.  Fit the full model.  Also, compute odds ratios for the coefficients.  [2]

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


2.  Interpret the coefficient(s) for one of your explanatory variables in terms of the change in the log odds. [1]

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

YOUR INTERPRETATION HERE

:::

3.  Interpret the odds ratio for the binary explanatory variable. [1]

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

YOUR INTERPRETATION HERE

:::

4.  Compute and interpret the relative risk for the binary explanatory variable. [2]

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


YOUR INTERPRETATION HERE

:::


5.  Interpret the odds ratio for the continuous explanatory variable.  [1]

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

YOUR INTERPRETATION HERE

:::

6.  Make a publication-quality table that presents the results of the reduced and full models side by side.  The table should _use the untransformed coefficients and not the odds ratios_.  [6]

The table should have:

- a substantively clear title
- coefficients for two models side-by-side, with the reduced model on the left.
- substantively meaningful labels for the rows 
- column labels (for example, "Model 1" and "Model 2")
- coefficients presented to 2 or 3 decimal places 
- standard errors or z-scores underneath in parentheses
- asterisks to indicate the statistical significance of coefficients
- a table note indicating what is in parentheses and what the asterisks mean, as well as anything else of note (e.g., the omitted category if one of the explanatory variables is a series of dummies)
- N as the last row of the table (N must be the same for the two models. You may need to drop observations that are missing for any values in the full model before fitting the reduced model in order to ensure this.) 

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

7.  Write a brief, effective paragraph describing conclusions you draw about the relationship between your explanatory variable and the outcome, given what you've learned from fitting the two models.  You may use interpretations provided above if you wish.  But, what we are looking for here is you speaking to the substance of the matter rather than constructing a series of rote sentences. [3]

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

YOUR INTERPRETATION HERE

:::



