ADVERTISEMENT
Google AdSense Slot (headerLeaderboard)
Set your Publisher ID in src/config/ads.ts to display live ads.
R Statistical Programming Tutorial• 6 min read
Linear Regression with lm()
Perform ordinary least squares regression with lm(), extract R-squared, and test statistical significance.
Fitting Linear Models
Formulas in R use the tilde: model <- lm(sales ~ ad_spend + region, data = df). Inspect p-values and coefficients via summary(model).
ADVERTISEMENT
Google AdSense Slot (inContentBanner)
Set your Publisher ID in src/config/ads.ts to display live ads.
Test Yourself With Exercise
What symbol separates the dependent variable from the predictor variables in R formula syntax (e.g. y ~ x)?