This video demonstrates how to perform simple linear regression in R using the lm() function, where the model salary = β₀ + β₁ × experience + error is tested by examining coefficient estimates, t-values, p-values, R², and F-statistic to determine if a significant linear relationship exists between years of experience and salary.
深掘り
前提条件
- データがありません。
次のステップ
- データがありません。
深掘り
Performing Regression in R. #econometrics #regression #R追加:
So far we have learned many important things which are essential to interpret the result of regression analysis and now we will run the regression on our software and try to examine it. We will be using data on number of years of experience and salary and try to check if there exist a relationship between these variables. Here the number of experience is X variable and salary is Y variable. Our model will look like salary is equal to beta zero plus beta one into experience plus error term. We will have our null hypothesis as the number of years of experience does not have a simple linear relationship with salary. On our software we will first call library read excel and then create an object named data using read excel function and call our data.
Then we will use STR function to see the structure of data as visible on the screen. Here we can see that the first column is for years of experience and second is for the salary.
Then we will name columns as X and Y and check the structure again. After that we will create an object named model and regress our data using the linear model LM function as shown on the screen.
After this to get a summary of regression we will run summary model which will give us summary of residuals, coefficient estimates, standard error, T value, R squared, adjusted R squared and F statistic. Here we can see that the intercept or beta zero hat estimate is 24,848.2.
The slope or beta one hat estimate is 9,450.
The high T value and very low P value for both estimates are significant to reject the null hypothesis and we can say that there exist a linear relationship between numbers of years of experience and salary. We can see that both R squared and adjusted R squared are above 0.95, which means they fit the model very well. The high F statistic along with low P value indicates that the simple linear regression model is statistically significant overall. Meaning the independent variable explains a significant portion of the variation in the dependent variable. The overall F statistic and the T test for the slope coefficient are effectively testing the same thing because it is simple linear regression. We can use this regression model in R for further examination using the object named model. Follow for upcoming videos.
関連おすすめ
JPMorgan CEO JUST NUKED Mamdani... as NYC's Middle Class COLLAPSES
Englishman-In-NewYork
7K views•2026-05-30
Why Canadians can no longer afford to survive #canada #inflation #shorts
TrueNorthInvestor-v4j
131 views•2026-06-01
The Hidden Difference Between Breakouts & Real Moves #trading #orderflow
SmartMoneyFutures
272 views•2026-06-02
What has a broader economic impact, corporate downsizing or ecological collapse?
theratracejournal
1K views•2026-05-29
China Is Quietly Buying Gold, the Iran Deal Is Frozen, and Silver Is Heating Up
RichardHolloway0
694 views•2026-05-31
Uranium Isn’t Priced Like Other Metals
vricmedia
929 views•2026-06-02
I Think Oil Futures Dropped Before Trump’s Iran Statement — And Here’s Why
bradicemancolbert
709 views•2026-06-02
After waiting 90 minutes, CA mom and baby leave ER before treatment. Then came a $4.9K bill.
abc7news
290 views•2026-06-04
トレンド
Why Batman Lets The Joker Live 🤨
zackdfilms
9222K views•2026-05-30
They're Complete Trash
penguinz0
558K views•2026-06-04
The Murder of Deputy Caleb Conley
MidwestSafety
810K views•2026-06-04
I Bought FAKE HopeScope Merch (and paid a subscriber to give it a makeover) | Hopeful Hauls
HangWithHopescope
158K views•2026-06-04











