Code:
df = read.csv('https://www.marksmath.org/data/peach_tree2015.csv')
df2 = subset(df, Gender == "M" & Age > 25)
set.seed(3) # Your seed is set to your position in the Groovy Class Randomizer
dfs = df2[sample(length(df2$Age), 200),]
plot.reg = lm(Net.Time~Age, data = dfs)
summary(plot.reg)
Response:
Call:
lm(formula = Net.Time ~ Age, data = dfs)
Residuals:
Min 1Q Median 3Q Max
-31.617 -13.933 -3.666 11.684 62.310
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 57.6962 4.9084 11.755 < 2e-16 ***
Age 0.2819 0.1050 2.684 0.00788 **
Signif. codes: 0 ‘’ 0.001 ‘’ 0.01 ‘’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 18.24 on 198 degrees of freedom
Multiple R-squared: 0.03512, Adjusted R-squared: 0.03024
F-statistic: 7.206 on 1 and 198 DF, p-value: 0.00788
taken from y=mx + b
y= 0.2819x + 57.6962
Mark’s Time
t=0.2818(54)+57.6962
t= 72.9134 or t= 72.91 minutes / he’s much slower
since
male times = 0.2819(age) + b
Code:
plot(Net.Time~Age, data = dfs, xlab = "Age", ylab = "Net.Time", col = "red", pch = "red")
abline(reg = plot.reg, col = "black")
p-value: 0.00788
A relative small p-value represents a genuine relationship that males over 25 years of age have slower times. We would reject the null that states there’s not a relationship between age and times at a significance level of 0.05 since the p-value<0.05.