2025-06-10

Linear Regression

  • Linear Regression
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
## 
## 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
## Warning: Ignoring 53573 observations

Slide with R Output

## 
## Call:
## lm(formula = movies$rating ~ movies$budget)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -5.1533 -0.9518  0.1495  1.0558  3.8467 
## 
## Coefficients:
##                 Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    6.153e+00  2.471e-02 249.067   <2e-16 ***
## movies$budget -9.427e-10  9.175e-10  -1.027    0.304    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.547 on 5213 degrees of freedom
##   (53573 observations deleted due to missingness)
## Multiple R-squared:  0.0002025,  Adjusted R-squared:  1.068e-05 
## F-statistic: 1.056 on 1 and 5213 DF,  p-value: 0.3043

Slide Scatterplot

## Warning: Use of `movies$rating` is discouraged.
## ℹ Use `rating` instead.
## Warning: Use of `movies$budget` is discouraged.
## ℹ Use `budget` instead.
## Warning: Removed 53573 rows containing missing values or values outside the scale range
## (`geom_point()`).

Slide Scatterplot with line

## Warning: Use of `movies$rating` is discouraged.
## ℹ Use `rating` instead.
## Warning: Use of `movies$budget` is discouraged.
## ℹ Use `budget` instead.
## Warning: Use of `movies$rating` is discouraged.
## ℹ Use `rating` instead.
## Warning: Use of `movies$budget` is discouraged.
## ℹ Use `budget` instead.
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 53573 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Warning: Removed 53573 rows containing missing values or values outside the scale range
## (`geom_point()`).