lm: Simple Linear Regression (with CSV Data)

Exercise template for conducting a simple linear regression based on a randomly-generated CSV file.

Name:
lm
Type:
Related:
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
Template:
Raw: (1 random version)
PDF:
lm-Rmd-pdf
lm-Rnw-pdf
HTML:
lm-Rmd-html
lm-Rnw-html

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")