3+3
## [1] 6
3-3
## [1] 0
3*3
## [1] 9
3/3
## [1] 1
library(readxl)
asia <- read_excel("asia.xlsx")
head(asia)
## # A tibble: 6 × 10
## countrycode country year rgdpe pop ctfp percapitaGDP oecd G7 asia
## <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 CHN China 2019 2.01e7 1.43e3 0.400 13988. 0 0 1
## 2 JPN Japan 2019 5.03e6 1.27e2 0.635 39637. 1 1 1
## 3 KOR Republic… 2019 2.09e6 5.12e1 0.604 40819. 1 0 1
## 4 PHL Philippi… 2019 8.87e5 1.08e2 0.507 8205. 0 0 1
## 5 SGP Singapore 2019 5.14e5 5.80e0 0.691 88619. 0 0 1
## 6 THA Thailand 2019 1.22e6 6.96e1 0.455 17558. 0 0 1
barplot(asia$pop, names.arg=asia$countrycode)
barplot(asia$ctfp,names.arg = asia$countrycode)
plot(asia$pop,asia$rgdpe,log = "xy",xlab="Population",ylab="GDP")
ols<-lm(asia$rgdpe ~ asia$pop)
summary(ols)
##
## Call:
## lm(formula = asia$rgdpe ~ asia$pop)
##
## Residuals:
## 1 2 3 4 5 6 7
## -78765 2386665 461636 -1503740 -506974 -653091 -105731
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 943660 572257 1.649 0.16
## asia$pop 13385 1047 12.785 5.21e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1332000 on 5 degrees of freedom
## Multiple R-squared: 0.9703, Adjusted R-squared: 0.9644
## F-statistic: 163.5 on 1 and 5 DF, p-value: 5.208e-05
plot(asia$pop,asia$rgdpe,xlab="Population",ylab="GDP")
abline(ols)
model <- lm(asia$rgdpe ~ asia$pop)
summary(model)
##
## Call:
## lm(formula = asia$rgdpe ~ asia$pop)
##
## Residuals:
## 1 2 3 4 5 6 7
## -78765 2386665 461636 -1503740 -506974 -653091 -105731
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 943660 572257 1.649 0.16
## asia$pop 13385 1047 12.785 5.21e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1332000 on 5 degrees of freedom
## Multiple R-squared: 0.9703, Adjusted R-squared: 0.9644
## F-statistic: 163.5 on 1 and 5 DF, p-value: 5.208e-05
library(modelsummary)
library(ggplot2)
library(flextable)
modelsummary(model, stars = TRUE)
| (1) |
|---|---|
(Intercept) | 943659.767 |
(572257.202) | |
asia$pop | 13384.984*** |
(1046.895) | |
Num.Obs. | 7 |
R2 | 0.970 |
R2 Adj. | 0.964 |
AIC | 220.9 |
BIC | 220.8 |
Log.Lik. | -107.470 |
RMSE | 1125766.22 |
+ p < 0.1, * p < 0.05, ** p < 0.01, *** p < 0.001 | |
modelplot(model)