3b Activity: Code-Generated Results

Goal

We will add a few analysis tools to the practice project, update paper.qmd so it generates results from code, and render the paper again.

Note: The checkboxes on this page are only stored locally in your browser. They are not submitted or synced anywhere.

Progress: 0 / 0 steps complete.

Activity

Open the python_tmr_practice repository in Codespaces.

Open pyproject.toml and add three packages to the dependencies list:

"maketables==0.1.8",
"matplotlib==3.10.9",
"statsmodels==0.14.6",

Install from the project:

python -m pip install -e .

Open paper.qmd.

Find the section named ## A Small Code Example.

Replace that section, stopping before ## References, with this:

Click inside the block to select it, then copy and paste it into paper.qmd.

Save the file.

In the terminal, render the paper:

quarto render paper.qmd

Then render the whole project:

quarto render

Open the rendered output and look for:

  • the inline sample size;
  • the descriptive statistics table;
  • the lower-triangle correlation table;
  • the scatter matrix;
  • the regression table with model diagnostics;
  • the inline regression coefficient and p value.

In the hidden setup chunk, find this line:

0.45 * attention

Change 0.45 to 0.75.

Render paper.qmd again.

Check whether the regression table and inline coefficient changed.

Use Source Control:

  1. Review the changes.
  2. Stage pyproject.toml and paper.qmd.
  3. Commit with a message such as:
Added code-generated paper results.

Push or sync the commit to GitHub.