x <- seq(-4, 4, 0.005)
y1 <- dnorm(x, mean=0, sd=1)
plot(x, y1, type="l", ylim=c(0, 1), xlab="", ylab="",
main="Normal Density with Mean=0, SD=1")
y2 <- dnorm(x, mean=0, sd=0.5)
plot(x, y2, type="l", ylim=c(0, 1), xlab="", ylab="",
main="Normal Density with Mean=0, SD=0.5")
y3 <- dnorm(x, mean=0, sd=0.2)
plot(x, y3, type="l", ylim=c(0, 1), xlab="", ylab="",
main="Normal Density with Mean=0, SD=0.2")
# Replace the previous plot with the following to view the
# entire density:
plot(x, y3, type="l", ylim=c(0, 2), xlab="", ylab="",
main="Normal Density with Mean=0, SD=0.2")
x <- seq(-1, 3, 0.005)
y1 <- dunif(x, min=0, max=2)
plot(x, y1, type="l", ylim=c(0, 2), xlab="", ylab="",
main="Uniform Density with Min=0, Max=2")
y2 <- dunif(x, min=0, max=1)
plot(x, y2, type="l", ylim=c(0, 2), xlab="", ylab="",
main="Uniform Density with Min=0, Max=1")
y3 <- dunif(x, min=0, max=0.5)
plot(x, y3, type="l", ylim=c(0, 2), xlab="", ylab="",
main="Uniform Density with Min=0, Max=0.5")
Look at the Bivariate Datasets document to help you with review exercises 5, 6, and 7.
setwd("c:/workspace")
getwd( )
[1] "c:/workspace"
# Create a dataframe df to hold the 2026 Bears Roster
# First download the bears-2026-roster into
# the c:/workspace directory (folder).
df <- read.csv("bears-2026-roster.txt")
# Create data vector of players heights in meters:
h <- (df$HtFt + df$HtIn / 12) * 0.3048
# Create data vector of players weights in kilos:
w <- df$Weight * 0.4536
plot(h, w, xlab="Player Height (Meters)",
ylab="Player Weight (Kilos),
main="Height and Weight of 2026 Bears Roster")
> cor(h, w) [1] 0.624795
> model <- lm(w ~ h)
Call:
lm(formula = w ~ h)
Coefficients:
(Intercept) h
-244.1 187.6
This means that the simple linear regression equation, sometimes known as
the trend line, is