Created
July 14, 2021 12:00
-
-
Save thengl/a89fcb49b366aff47bc1ad4479651579 to your computer and use it in GitHub Desktop.
This file contains 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
## Synthetic data ---- | |
set.seed(200) | |
n = 100 | |
x <- 1:n | |
y <- x + rnorm(n = 50, mean = 15, sd = 15) | |
## Synthetic linear model ---- | |
m0 <- lm(y ~ x) | |
summary(m0) | |
# Residuals: | |
# Min 1Q Median 3Q Max | |
# -27.6093 -6.4396 0.6437 6.7742 26.7192 | |
# | |
# Coefficients: | |
# Estimate Std. Error t value Pr(>|t|) | |
# (Intercept) 14.84655 2.37953 6.239 1.12e-08 *** | |
# x 0.97910 0.04091 23.934 < 2e-16 *** | |
# --- | |
# Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 | |
# | |
# Residual standard error: 11.81 on 98 degrees of freedom | |
# Multiple R-squared: 0.8539, Adjusted R-squared: 0.8524 | |
# F-statistic: 572.9 on 1 and 98 DF, p-value: < 2.2e-16 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment