lm: Simple Linear Regression (with CSV Data)
Name:
lm
Type:
Preview:
Using the data provided in regression.csv estimate a linear regression of y
on x
and answer the following questions.
Estimated slope with respect to x
:
To replicate the analysis in R:
## data
d <- read.csv("regression.csv")
## regression
m <- lm(y ~ x, data = d)
summary(m)
## visualization
plot(y ~ x, data = d)
abline(m)
Using the data provided in regression.csv estimate a linear regression of y
on x
and answer the following questions.
Estimated slope with respect to x
:
To replicate the analysis in R:
## data
d <- read.csv("regression.csv")
## regression
m <- lm(y ~ x, data = d)
summary(m)
## visualization
plot(y ~ x, data = d)
abline(m)
Using the data provided in regression.csv estimate a linear regression of y
on x
and answer the following questions.
Estimated slope with respect to x
:
To replicate the analysis in R:
## data
d <- read.csv("regression.csv")
## regression
m <- lm(y ~ x, data = d)
summary(m)
## visualization
plot(y ~ x, data = d)
abline(m)
Description:
Bivariate numeric data for download in a CSV file (comma-separated values) need to be assessed using a simple linear regression (one single-choice and one numeric item).
Solution feedback:
Yes
Randomization:
Random numbers, data file, and graphics
Mathematical notation:
No
Verbatim R input/output:
Yes
Images:
Yes
Other supplements:
regression.csv
Demo code:
library("exams")
set.seed(403)
exams2html("lm.Rmd")
set.seed(403)
exams2pdf("lm.Rmd")
set.seed(403)
exams2html("lm.Rnw")
set.seed(403)
exams2pdf("lm.Rnw")