Rayanna Osborne Warren
2026-02-10
## Loading required package: ggplot2
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
##
## Call:
## lm(formula = weight ~ height, data = howell_clean)
##
## Residuals:
## Min 1Q Median 3Q Max
## -17.4179 -2.9406 -0.1327 2.8434 13.1366
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -50.48852 3.97234 -12.71 <2e-16 ***
## height 0.61542 0.02568 23.96 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 4.336 on 471 degrees of freedom
## Multiple R-squared: 0.5494, Adjusted R-squared: 0.5485
## F-statistic: 574.3 on 1 and 471 DF, p-value: < 2.2e-16
Variables Observed in a Simple Linear Regression:
##
## Call:
## lm(formula = weight ~ height, data = howell_clean)
##
## Residuals:
## Min 1Q Median 3Q Max
## -17.4179 -2.9406 -0.1327 2.8434 13.1366
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -50.48852 3.97234 -12.71 <2e-16 ***
## height 0.61542 0.02568 23.96 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 4.336 on 471 degrees of freedom
## Multiple R-squared: 0.5494, Adjusted R-squared: 0.5485
## F-statistic: 574.3 on 1 and 471 DF, p-value: < 2.2e-16
height_seq <- seq( min(howell_clean\(height), max(howell_clean\)height), length.out = 100 )
pred_df <- data.frame( height = height_seq, weight = predict(model_hw, newdata = data.frame(height = height_seq)) )
p <- plot_ly() %>% add_markers( data = howell_clean, x = ~height, y = ~weight, marker = list(size = 6, opacity = 0.6), name = “Observed Data” ) %>% add_lines( data = pred_df, x = ~height, y = ~weight, line = list(width = 2, color = “darkred”), name = “Line of Best Fit” ) %>% layout( title = “Height vs Weight”, xaxis = list(title = “Height (cm)”), yaxis = list(title = “Weight (kg)”) )
## `geom_smooth()` using formula = 'y ~ x'
ggplot(howell_clean, aes(x = age, y = height)) + geom_point(alpha = 0.6) + geom_smooth(method = “lm”, se = FALSE, color = “blue”) + labs( title = “Age vs Height”, x = “Age (years)”, y = “Height (cm)” ) + theme_light()
## `geom_smooth()` using formula = 'y ~ x'
\[ \hat(weight) = \beta_0 + \beta_1 \cdot height \]
Below is the linear regression model for height and weight based on the data taken from lgrdata:Howell:
$$ = -50.49 + 0.615 height