Ekonometrika
Exercise 1
| Kontak | : \(\downarrow\) |
| ali.19arifin@gmail.com | |
| https://www.instagram.com/arifin.alicia/ | |
| RPubs | https://rpubs.com/aliciaarifin/ |
| Nama | Alicia Arifin |
| NIM | 20214920001 |
| Prodi | Statistika, 2021 |
Exercise
GDP & Unemployment rate
Let’s consider a scenario where we want to analyze the relationship between a country’s GDP (Gross Domestic Product) and its unemployment rate. The hypothesis is that higher GDP leads to lower unemployment rates due to increased economic activity and job creation. First, we’ll generate a simulated dataset with two variables: GDP and unemployment rate. We’ll assume a linear relationship between the two variables with some random noise.
set.seed(123)
n=10000
gdp <- rnorm(n, mean =1000,sd=200)
unemployment <- 10-0.05*gdp+rnorm(n,mean=0,sd=2)
data<- data.frame(
GDP=gdp,
Unemployment=unemployment
)
head(data)Your jobs:
1. Explore the data visually to understand the
relationship between GDP and unemployment rate 2. Perform simple linear
regression to quantify the relationship between GDP and unemployment
rate 3. Interpret the relationship between GDP and unemployment
rate.
1
Explore the data visually to understand the relationship between GDP and unemployment rate
Correlation between Unemployment and GDP is -0.98.
library(ggplot2)
library(tidyverse)
ggplot(data, aes(x=GDP, y=Unemployment ))+
geom_point(color="sky blue")+
ggtitle("GDP vs Unemployment")
The hypothesis is that higher GDP leads to lower unemployment rates due
to increased economic activity and job creation.
From the
scatterplot above, accept hypothesis. higher the GDP, then the
unemployement rate will be lower. The relation between variable are
negative. The plot shows that the data makes a linear shape. Because of
linear, we can use a simple regression linear.
2
Perform simple linear regression to quantify the relationship between GDP and unemployment rate
ggplot(data, aes(x=GDP, y=Unemployment ))+
geom_point(color="orange")+
geom_smooth(method = "lm")+
ggtitle("GDP vs Unemployment")##
## Call:
## lm(formula = unemployment ~ gdp)
##
## Residuals:
## Min 1Q Median 3Q Max
## -6.9652 -1.3378 -0.0148 1.3617 7.5393
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 9.9214218 0.1022358 97.04 <2e-16 ***
## gdp -0.0499396 0.0001003 -497.89 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.003 on 9998 degrees of freedom
## Multiple R-squared: 0.9612, Adjusted R-squared: 0.9612
## F-statistic: 2.479e+05 on 1 and 9998 DF, p-value: < 2.2e-16
the linear regression from that data set are\[ Unemployment = 9.92 - 0.05 * GDP \] GDP has a statistically significant negative impact on Unemployment.
3
Interpret the relationship between GDP and unemployment rate.
Relationship between GDP and Unemployment rate is negative relation. If
we want to decrease our unemployment rate, we must increase our GDP. the
starting rate of unemployment is 9,92. GDP has an impact by negative
0,05.
GDP Growth Rate and Investment Rate
The objective of this study case is to demonstrate how simple linear
regression can be used to analyze economic data and make predictions
based on the relationship between two variables. Lets generate data for
GDP growth rate (gdp_growth) and investment rate
(investment_rate) for a fictional country over a period of
10 years.
set.seed(123)
years<- 1:10
invesment_rate <- rnorm(10,mean=20,sd=5)
gdp_growth <- 3 +0.8*invesment_rate+ rnorm(10,mean=0,sd=1)
data<- data.frame(years, invesment_rate, gdp_growth)
dataYour Jobs:
1. Perform simple linear regression analysis to
understand the relationship between GDP growth rate and investment rate
2. Make predictions about future GDP growth rates based on different
levels of investment 3. Gained insights into how changes in investment
may influence economic growth.
1
Perform simple linear regression analysis to understand the relationship between GDP growth rate and investment rate
ggplot(data, aes(x=invesment_rate, y=gdp_growth ))+
geom_point(color="#D24545")+
geom_smooth(method = "lm")+
ggtitle("Invesment Rate vs GDP Growth")##
## Call:
## lm(formula = invesment_rate ~ gdp_growth)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.58676 -0.37809 0.05946 0.70065 1.15079
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.0498 1.4118 0.035 0.973
## gdp_growth 1.0418 0.0707 14.736 4.42e-07 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.9535 on 8 degrees of freedom
## Multiple R-squared: 0.9645, Adjusted R-squared: 0.96
## F-statistic: 217.1 on 1 and 8 DF, p-value: 4.423e-07
The relationship between invesment rate and gdp growth is positive
relationship. The Regression formula is
invesment_rate = 0.0498 + 1.04 *gdp_growth. Invesment rate
has a statistically significant impact on GDP growth.
2 & 3
Make predictions about future GDP growth rates based on different
levels of investment
Gained insights into how changes in investment
may influence economic growth.
Relationship between GDP growth and
invesment rate is positive relation. More invesment rate goes up, GDP
will continue to grow. The starting invesment rate is 0,0498. GDP growth
has a positive impact by 1,0418 Unit if invesment rate increases per 1
unit.