Skip to content

Instantly share code, notes, and snippets.

@mvuorre
Created July 3, 2025 16:51
Show Gist options
  • Select an option

  • Save mvuorre/537a8e41d57f504ba1f375fa867ba57e to your computer and use it in GitHub Desktop.

Select an option

Save mvuorre/537a8e41d57f504ba1f375fa867ba57e to your computer and use it in GitHub Desktop.
---
title: A linear regression example
author: Matti Vuorre
format: typst
---
What is the regression coefficient of $y$ on $x$? Find out in @tbl-1 (see @lst-1)!
```{r}
#| label: tbl-1
#| lst-label: lst-1
#| lst-cap: Linear regression in R.
#| tbl-cap: Revealing the relationship between y and x.
x <- rnorm(30)
y <- rnorm(30) + 0.1 * x
model <- lm(y ~ x)
knitr::kable(broom::tidy(model), digits = 2)
```
@mvuorre
Copy link
Author

mvuorre commented Jul 3, 2025

Screenshot of output pdf: example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment