R 1 1 1 2017 2 15 2017 2 15 1/64
2 R 3 R R RESAS 2017 2 15 2/64
2 R 3 R R RESAS 2017 2 15 3/64
2-4 ( ) ( (80%) (20%) 2017 2 15 4/64
PC LAN R 2017 2 15 5/64
R R 2017 2 15 6/64
3-4 R 15 + 2017 2 15 7/64
R STATA Eviews MATLAB STATA R 2017 2 15 8/64
R 2017 2 15 9/64
R R Windows Mac Linux R Comprehensive R Archive Network (CRAN: ) http://cran.ism.ac.jp/ 2017 2 15 10/64
2017 2 15 11/64
2017 2 15 12/64
R R A B Word 2017 2 15 13/64
R > ( ) + esc 2017 2 15 14/64
(1): > x <- 1.5+2.5 # x > x [1] 4 > 2.5* x [1] 10 2017 2 15 15/64
(2): > y <- c(1,2,3) # y y = [ 1 2 3 ] > y * y [1] 1 4 9 2017 2 15 16/64
(2): y y = [ 1 2 3 ] 1 2 = 1 1 + 2 2 + 3 3 = 14 3 > y %*% y # % [1] 14 > z <- c(1,2,3,4,5,6) > z.mat <- matrix(z,nrow=2,ncol=3) > z.mat [,1] [,2] [,3] [1,] 1 3 5 [2,] 2 4 6 2017 2 15 17/64
> z.mat[1,] [1] 1 3 5 > z.mat[,2] [1] 3 4 2017 2 15 18/64
(3): > f <- expression(x^2) > D(f,"x") 2*x > h <- expression(x^2+3*x*y) > D(h,"x") 2*x+3*y 2017 2 15 19/64
> testfunction<- function(x^2) > x<-seq(-5,10,0.1) > plot(x, testfunction(x),type="l") ggplot2 1 : y = x 2 2017 2 15 20/64
R R CRAN 8,000 2017 2 15 21/64
2 : 2017 2 15 22/64
Nippon (https://prs.ism.ac.jp/userjp/) 2013 ( ) 2017 2 15 23/64
Nippon (2013) > setwd("/users/xxxx/r/gis/nipponpackage") # > library(nippon) > library(rcolorbrewer) > library(maptools) > library(classint) # > data<-read.table("nipponpackagetest.csv",sep=",",header=true) > op <- par(bg = "skyblue") # # : > p <- JapanPrefecturesMap(col = "ivory") > colleges <- data$colleges # # ( ) > cols <- rev(brewer.pal(5, "RdYlBu")) # n > c1 <- classintervals(colleges, n = 5, style = "fisher") > colcode1 <- findcolours(c1, cols, cutlabels = FALSE) # # 1 ( > legtext1 <- paste0(names(attr(colcode1,"table")), " (", attr(colcode1, "table"),")") > p <- JapanPrefecturesMap(col = colcode1) # ( # ( > legend("bottomright", legend = legtext1,fill = cols, title = "Colleges",bg = "white") 2017 2 15 24/64
2017 2 15 25/64
(1) Nippon http://www.stat.go.jp/data/k-sugata/naiyou.htm#mokuji2 2017 2 15 26/64
2 R 2 R 3 R R RESAS 2017 2 15 27/64
2 R (π) (P Y ) (C(Y )) max Y π = P Y C(Y ) (1) Y 2017 2 15 28/64
2 R Hoover(2012, P331) 1 2008 Y = 9.63L 0.67 K 0.33 (2) Y L K Y = AL a K 1 a (A ) 1 Hoover, KD(2012) Applied intermediate macroeconomics, Cambridge University Press. 2017 2 15 29/64
2 R > plotfun(a*(l^0.7)*(k^0.3)~l&k, A=5,xlim=range(0,21), ylim=range(0,100), filled=false, surface=true ) mosaic A * (L^0.7) * (K^0.3) K L 2017 2 15 30/64
2 R > library(mosaic) > plotfun(a*(l^0.7)*(k^0.3)~l,k=20,a=5,xlim=range(-1,21), ylim=range(-5,105)) 80 A * (L^0.7) * (K^0.3) 60 40 20 0 0 5 10 15 20 L 2017 2 15 31/64
2 R K Y > plotfun(a*(l^0.7)*(k^0.3)~l,k=20,a=5,xlim=range(-1,21), ylim=range(-5,151)) > plotfun(a*(l^0.7)*(k^0.3)~l, K=40,A=5,xlim=range(-1,21), ylim=range(-5,151), lty=2,add=true ) A * (L^0.7) * (K^0.3) 100 50 0 0 5 10 15 20 L 2017 2 15 32/64
2 R A Y > plotfun(a*(l^0.7)*(k^0.3)~l,k=20,a=5,xlim=range(-1,21), ylim=range(-5,151)) > plotfun(a*(l^0.7)*(k^0.3)~l,k=20, A=10,xlim=range(-1,21), ylim=range(-5,151), lty=2,add=true ) A * (L^0.7) * (K^0.3) 100 50 0 0 5 10 15 20 L 2017 2 15 33/64
20 40 80 120 140 160 ( ) 2 R > plotfun(a*(l^0.7)*(k^0.3)~l&k,a=5,xlim=range(0,21), ylim=range(0,100), filled=false) 80 60 100 K 40 60 20 5 10 15 20 L 2017 2 15 34/64
3 R 2 R 3 R R RESAS 2017 2 15 35/64
3 R (U) U x (x, y) p x = U y(x, y) p y (3) U x (x, y) U(x,y) x, P i i 2017 2 15 36/64
3 R : (1) p x = 1, p y = 2 U = x + 2 x y + y (4) U x = 1 + x 1 2 y, U y = 1 + x y 1 2 (5) (3) y 1 2 x 1 2 = 1 2 (6) 2017 2 15 37/64
3 R : (2) : p x x + p y y = m ( m ) (3) x = mp y p x (p x + p y ), and y = mp x p y (p x + p y ) (7) m = 6 x = 4 y = 1 2017 2 15 38/64
3 R R max U = x + 2 x y + y (8) s.t. x + 2y = 6 (9) x = 4 y = 1 2017 2 15 39/64
3 R R 1 x< seq(0,5,1) # 0 5 1 2 y< seq(0,5,1) # 0 5 1 3 g< function(x,y) x+2 sqrt(x y)+y # 4 z< outer(x,y,g) # x y g 5 contour(x,y,z) # x-y 6 par(new=t) # 7 8 contour(x,y,z,level=9) # x-y z=9 9 par(new=t) 10 11 gg< function(x,y) x+2 y # 12 z< outer(x,y,gg) # x y gg 13 contour(x,y,z,level=6, col="red",lwd=3,xlab="x", ylab="y") 14 15 abline(h=1,lty=2) # x=1 ( ) 16 abline(v=4,lty=2) # y=4 ( ) 2017 2 15 40/64
3 R 2017 2 15 41/64
R 2 R 3 R R RESAS 2017 2 15 42/64
R 2017 2 15 43/64
R (2b) 2017 2 15 44/64
R (2c) 2017 2 15 45/64
R 2 i, j R D GDP R ij = GDP igdp j D ij (10) ln R ij = β 0 + β 1 ln GDP i + β 2 ln GDP j β 3 ln D ij + ϵ (11) 2017 2 15 46/64
R UN Comtrade CEPII (BACI) GDP World Development Indicators R WDI CEPII The CEPII Gravity Dataset 2017 2 15 47/64
R I Y = α + βx (12) 2 2017 2 15 48/64
R II (X i, Y i ) µ i µ i = Y i α βx i (13) 2 2017 2 15 49/64
R (1) J α β α β J = n ˆµ 2 i = (Y i α βx i ) 2 (14) J α = i=1 n [ 2(Y i α βx i )] = 0 (15) i=1 J β = n [ 2X i (Y i α βx i )] = 0 (16) i=1 2017 2 15 50/64
R (2) ˆβ = n i=1 (X i X)(Y i Y ) n i=1 (X i X) 2 (17) ˆα = Y ˆβX (18) ˆα ˆβ 2017 2 15 51/64
R : GDP WDI GDP 1 library(wdi) # WDI 2 3 WDIsearch(string="GDP") # GDP 4 5 dat < WDI(indicator= NY.GDP.MKTP.CD, country=c( JP, KR, CN ), start=1980, end=2012) 6 # 1980-2012 GDP 7 8 library(ggplot2) # 9 10 ggplot(dat, aes(year, NY.GDP.MKTP.CD/1000000000, color= country)) + geom line() + 11 xlab( Year ) + ylab( GDP (current billion US$) ) 2017 2 15 52/64
R GDP 7500 GDP (current billion US$) 5000 country China Japan Korea, Rep. 2500 0 1980 1990 2000 2010 Year 2017 2 15 53/64
R R : (1) 1 trade.lm< lm(log(trade) log(gdp)+log(gdp.china)+log( distance), data=dataset) 2 # OLS 3 4 summary(trade.lm) # 2017 2 15 54/64
R R : (2) 1 2 Coefficients: 3 Estimate Std. Er. t value Pr(> t ) 4 (Intercept) 0.06266 2.09973 0.030 0.97635 5 log(gdp) 1.14907 0.16279 7.059 2.05e 08 6 log(gdp.china) 0.72680 0.05279 13.768 2.39e 16 7 log(distance) 1.47430 0.41052 3.591 0.00093 8 9 Signif. codes: 0 0.001 0.01 0.05. 0.1 1 10 11 Residual standard error: 0.1927 on 38 degrees of freedom 12 Multiple R squared: 0.9716, Adjusted R squared: 0.9694 13 F statistic: 433.4 on 3 and 38 DF, p value: < 2.2e 16 2017 2 15 55/64
R (1) (null hypothesis) (H 0 ) (H 1 ) 2017 2 15 56/64
R (2) H 0 H 0 H 1 H 0 2017 2 15 57/64
R 3a OLS 2017 2 15 58/64
R R : (1) (colgpa) (hsgpa) (ACT) 1 library(foreign) # R 2 3 html< "http://fmwww.bc.edu/ec-p/data/wooldridge/gpa1.dta" # 4 5 gpa1< read.dta(html) # 6 7 GPAres< lm(colgpa hsgpa+act, data=gpa1) # 8 9 summary(gpares) # 2017 2 15 59/64
R R : (2) 1 Call:lm(formula = colgpa hsgpa + ACT, data = gpa1) 2 3 Residuals: 4 Min 1Q Median 3Q Max 5 0.85442 0.24666 0.02614 0.28127 0.85357 6 7 Coefficients: 8 Estimate Std. Error t value Pr(> t ) 9 (Intercept) 1.286328 0.340822 3.774 0.000238 10 hsgpa 0.453456 0.095813 4.733 5.42e 06 11 ACT 0.009426 0.010777 0.875 0.383297 12 13 Signif. codes: 0 0.001 0.01 0.05. 0.1 14 15 Residual standard error: 0.3403 on 138 degrees of freedom 16 Multiple R squared: 0.1764, Adjusted R squared: 0.1645 2017 2 15 60/64
R 3b OLS 2017 2 15 61/64
RESAS 2 R 3 R R RESAS 2017 2 15 62/64
RESAS RESAS RESAS RESAS RESAS 2017 2 15 63/64
RESAS Dayal, Vikram (2015) An Introduction to R for Quantitative Economics: Graphing, Simulating and Computing, Springer. Heisss, Florian (2016) Using R for Introductory Econometrics, www.urfie.net. ( ) (2008). (2000). (2012) RIETI (http://www.rieti.go.jp/users/tanaka-ayumu). (2016) R - -,. (1995). 2017 2 15 64/64