After cleaning up the data you generated in class today a bit more, I was able to run the linear regression commands in R and get sensible results. Here are two CSV files you can use to play around with R:
And here are the R commands I used to generate the plot below:
> math216A <- read.csv("C:/Users/bruffdo/Desktop/math216A.csv") > View(math216A) > height <- math216A$Height > shoe <- math216A$Shoe > plot(height,shoe) > fit <- lm(shoe ~ height) > abline(fit) > cor(height,shoe) [1] 0.4408186 > summary(fit) Call: lm(formula = shoe ~ height) Residuals: Min 1Q Median 3Q Max -3.7778 -1.1254 -0.2565 0.3380 9.4356 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -7.74116 5.49626 -1.408 0.16572 height 0.26220 0.07872 3.331 0.00171 ** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 2.351 on 46 degrees of freedom Multiple R-squared: 0.1943, Adjusted R-squared: 0.1768 F-statistic: 11.09 on 1 and 46 DF, p-value: 0.001713
Here’s the R-generated plot of shoe size versus height:
These data have a correlation coefficient of R = 0.44.