Last active
December 22, 2020 09:31
-
-
Save darioappsilon/75be176dbaf28962d36853f8fc12250e to your computer and use it in GitHub Desktop.
001_linear_regression
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(ggplot2) | |
| # Generate synthetic data with a clear linear relationship | |
| x <- seq(from = 1, to = 300) | |
| y <- rnorm(n = 300, mean = x + 2, sd = 25) | |
| # Convert to dataframe | |
| simple_lr_data <- data.frame(x, y) | |
| # Visualize as scatter plot | |
| ggplot(data = simple_lr_data, aes(x = x, y = y)) + | |
| geom_point(size = 3, color = "#0099f9") + | |
| theme_classic() + | |
| labs( | |
| title = "Dataset for simple linear regression", | |
| subtitle = "A clear linear relationship is visible" | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment