q( ) 2: R 2 R R R R C:nProgram FilesnRnrw1030) [File] [Change Dir] c:ndatadir OK 2

Size: px
Start display at page:

Download "q( ) 2: R 2 R R R R C:nProgram FilesnRnrw1030) [File] [Change Dir] c:ndatadir OK 2"

Transcription

1 R R R S Splus R S 1 R 1: R 2 [File] [Exit] 1

2 q( ) 2: R 2 R R R R C:nProgram FilesnRnrw1030) [File] [Change Dir] c:ndatadir OK 2

3 *3 7/3 7^3 2 > 7+3 [1] 10 > 7-3 [1] 4 > 7*3 [1] 21 > 7/3 [1] > 7^3 [1] 343 > 7*(1+2) [1] 21 > 2*6+2 [1] 14 > 6/3*2 [1] 4 > 2^3*4 [1] 32 R 1 R 2 [1] 3

4 > 2.5*3 [1] 7.5 > 2.5*4 [1] 10 > 2.5*5 [1] 12.5 > 2.5*6 [1] 15 > 2.5*7 [1] 17.5 > 2.5*8 [1] 20 > 2.5*9 [1] 22.5 > 2.5*10 [1] > h<-2.5 h h > h<-2.5 > h*3 [1] 7.5 > h*4 [1] 10 > h*5 3 < ; ; > 4

5 [1] 12.5 > h*6 [1] c( ) seq( ) rep( ) 2.5 h h* c( ) 4 > w<-c(3,4,5,6,7,8,9,10) > w [1] > h*w [1] w 3 10 h > w<-c(1,2,3,4,5,...,99,100) seq( ) c( ) c concatenate 5

6 > w<-seq(1,100) > w [1] [19] [37] [55] [73] [91] [1] [19] 6 > v<-seq(100,110) > v [1] > seq(100,110,2) [1] > seq(1,10)/10 [1] > seq(1,2,length=20) [1] [9] [17] seq(s,e) s e 1 2 seq(s,e,step) rep( ) rep(2,4) (2,2,2,2) rep( ) > rep(2,4) [1] > rep(c(0,1),3) [1] > rep(c(-1,0,1),c(1,2,3)) [1] [1] 6

7 2.3.2 > w[3] 3 w 3 3 w[3] [ ] > w<-seq(1,100) > w[3] [1] 3 > w[11:20] [1] > w[c(1,3,7,10)] [1] > w[seq(50,60)] [1] > w[seq(1,20,2)] [1] w[11:20] c( ) seq( ) seq(1,20,2) w>50 [ ] 50 w>50 w>50 TRUE FALSE W 1 50 w>50 50 TRUE FALSE 7

8 3: TRUE < > <= >= ==!= & and j or > w<-seq(1,10) > w [1] > w[w>=5 & w<=7] [1]

9 > w<-seq(1,10) > w [1] > w[-2] [1] > w[-c(1,3,5)] [1] > w[-2:9] Error: only 0's may mix with negative subscripts > w[-(2:9)] [1] : ; w<-seq(1,10) > w [1] > w+2 [1] > w-5 [1]

10 > x<-c(1,2,3,4,5) y<-c(1,3,5,7,9) > x+y [1] > x-y [1] > x*y [1] > x/y [1] R GDP 2 GDP c( ) matrix( ) matrix(,nrow=,ncol=,byrow=f or T) 1:6 > matrix(1:6,nrow=2) [,1] [,2] [,3] [1,]

11 [2,] > matrix(1:6,nrow=3) [,1] [,2] [1,] 1 4 [2,] 2 5 [3,] nrow nrow ncol byrow T F F T > matrix(1:6,nrow=2,byrow=t) [,1] [,2] [,3] [1,] [2,] > matrix(1:6,nrow=3,byrow=t) [,1] [,2] [1,] 1 2 [2,] 3 4 [3,] > A<-matrix(1:6,nrow=3) B<-matrix(c(1,3,5,7,9,11),nrow=3) > A [,1] [,2] [1,] 1 4 [2,] 2 5 [3,] 3 6 > B [,1] [,2] [1,] byrow 11

12 [2,] 3 9 [3,] 5 11 > A+B [,1] [,2] [1,] 2 11 [2,] 5 14 [3,] 8 17 > A-B [,1] [,2] [1,] 0-3 [2,] -1-4 [3,] -2-5 > A*B [,1] [,2] [1,] 1 28 [2,] 6 45 [3,] > A/B [,1] [,2] [1,] [2,] [3,] R %*% A B > A %*% B Error in A %*% B : non-conformable arguments 11 A B 3 2 AB 0 B t(b) 11 12

13 > A %*% t(b) [,1] [,2] [,3] [1,] [2,] [3,] > t(a) %*% B [,1] [,2] [1,] [2,] A c(1,2) 1 1 %*% > x<-c(1,2) > A %*% x [,1] [1,] 9 [2,] 12 [3,] 15 c(1,2,3) A > y<-c(1,2,3) > y %*% A [,1] [,2] [1,] A y y y 0 A R 13

14 GDP R gdpcons.txt ls( ) > ls() [1] "gdpcons" "last.warning" "year" gdpcons year 14 gdpcons > gdpcons GDP CONS [1,] [2,] [3,] [4,] [5,] [6,] [7,] [8,] [9,] [10,] [11,] [12,] [13,] [14,] [15,] [16,] [17,] [18,] [19,] [20,] [21,] > year [1] [16] gdpcons.txt rm( ) 14

15 gdpcons year 15 dim( ) length( ) > dim(gdpcons) [1] 21 2 > dim(year) NULL > length(year) [1] 21 dim( ) length( ) gdpcons year gdpcons 1 GDP 2 CONS > dimnames(gdpcons) [[1]] NULL [[2]] [1] "GDP" "CONS" dimnames( ) [[1]] [[2]] 16 NULL 1 \GDP" 2 \CONS" gdpcons > dimnames(gdpcons)[[1]]<-year > gdpcons GDP CONS

16 dimnames( ) 17 gdpcons GDP GDP gdpcons 1 [ ] A[1,1] 1 1 A(1,1) 1 GDP > gdpcons[1,1] [1] > gdpcons[1:3,1] > gdpcons[,1] gdpcons(1,1) 1:3 17 [[ ]]

17 1 3 1 gdpcons 3 gdpcons[3,] "GDP" "1980" 18 > gdpcons["2000","cons"] [1] > gdpcons["1995",] GDP CONS x<-c("a",1,2,3,"b") > x<-c("a",1,2,3,"b") > x [1] "a" "1" "2" "3" "b" GDP "bubble" "b" "a" "b" "bubble" "a" id" 18 R 17

18 > id<-c("b","b","b","b","b","b","b","bubble","bubble","bubble","bubble","bubble", + "a","a","a","a","a","a","a","a","a") > length(id) [1] R id gdpcons 3 rbind( ) cbind( ) cbind( ) > cbind(gdpcons,id) gdp cons id 1980 " " " " "b" 1981 " " " " "b" 1982 " " " " "b" 1983 " " "189292" "b" 1984 " " " " "b" 1985 " " " " "b" 1986 " " "209050" "b" 1987 " " " " "bubble" 1988 " " " " "bubble" 1989 " " " " "bubble" 1990 " " " " "bubble" 1991 " " " " "bubble" 1992 " " " " "a" 1993 " " " " "a" 1994 " " " " "a" 1995 " " " " "a" 1996 " " " " "a" 1997 " " " " "a" 1998 " " "285094" "a" 1999 " " " " "a" 2000 " " " " "a" data.frame( ) 18

19 > gdpcons<-data.frame(gdpcons,id) > gdpcons gdp cons id b b b b b b b bubble bubble bubble bubble bubble a a a a a a a a a data.frame( data.frame( ) gdp > gdpcons[,1] [1] [9] [17] > gdpcons$gdp [1] [9] [17] > attach(gdpcons) > gdp [1] [9] [17]

20 attach( ) 19 attach( ) detach( ) detach(gdpcons) attach(gdpcons) id > id [1] "b" "b" "b" "b" "b" "b" "b" "bubble" [9] "bubble" "bubble" "bubble" "bubble" "a" "a" "a" "a" [17] "a" "a" "a" "a" "a" 2.5 R R 4 > list(gdp,cons,id) [[1]] [1] [9] [17] [[2]] [1] [9] [17]

21 [[3]] [1] "b" "b" "b" "b" "b" "b" "b" "bubble" [9] "bubble" "bubble" "bubble" "bubble" "a" "a" "a" "a" [17] "a" "a" "a" "a" "a" gdp cons id list( ) [[1]] [[2]] [[3]] list(gdp,cons,id)[[2]] cons 3 GDP R 3.1 > attach(gdpcons) > plot(year,gdp) GDP 4 plot( ) X Y plot( ) 4 20 > plot(year,gdp,type="l",main="gdp from 1980 to 2000") 20 pch="." 21

22 gdp year 4: GDP type type="l" help(plot) 21 GDP from 1980 to 2000 gdp year 5: GDP ( ) R Version Microsoft Word 21 help.start( ) Internet Explorer 22

23 ps jpeg GDP plot(year,gdp,cons) 6 > plot(year,gdp,main="gdp and Consumption",type="l", + ylim=c(100000,600000)) > lines(year,cons,lty=2) plot( ) GDP lines( ) 2 ylim=c(100000,600000) GDP cons cons GDP lines(year,cons,...) lines( ) lty 22 GDP and Consumption gdp 1 e+05 2 e+05 3 e+05 4 e+05 5 e+05 6 e year 6: GDP 22 GDP CONS 23

24 3.2 plot( ) GDP gdp ; cons gdp 23 > par(mfrow=c(1,2)) > growth.gdp<-(gdp[2:21]-gdp[1:20])/gdp[2:21]*100 > growth.cons<-(cons[2:21]-cons[1:20])/cons[2:21]*100 > plot(year[2:21],growth.gdp,main="gdp and Consumption Growth", + type="l") > lines(year[2:21],growth.cons,lty=2) > saving.rate<-(gdp-cons)/gdp*100 > plot(year,saving.rate,main="macro Saving Rate", + type="l") 1 2 par( ) GDP plot( ) plot( ) lines( ) plot R 24

25 GDP and Consumption Growth Macro Saving Rate growth.gdp saving.rate year[2:21] year 4 7: GDP GDP GDP 4.1 mean( ) var( ) sqrt( ) 1 var( ) n (n-1)/n > mean(growth.gdp) mean(growth.cons) [1] [1] > n<-length(growth.gdp)

26 > sqrt(var(growth.gdp)*(n-1)/n) [1] > sqrt(var(growth.cons)*(n-1)/n) [1] GDP GDP > ysub<-seq(1981,2000) > mean(growth.gdp[ysub<=1989]) [1] > mean(growth.gdp[ysub>1989]) [1] > mean(growth.cons[ysub<=1989]) [1] > mean(growth.cons[ysub>1989]) [1] > sqrt(var(growth.gdp[ysub<=1989])) [1] > sqrt(var(growth.gdp[ysub>1989])) [1] > sqrt(var(growth.cons[ysub<=1989])) [1] > sqrt(var(growth.cons[ysub>1989])) [1] var( ) ysub

27 T F Volatility hist( ) GDP > hist(growth.gdp) 8 Histogram of growth.gdp Frequency growth.gdp 8: GDP 27

28 4.3 GDP GDP GDP GDP GDP vs Consumption growth.cons growth.gdp 9: GDP GDP GDP 28

29 C Y C = + Y ;1 H 0 : = 0 vs H 1 : 6= 0 > x<-growth.gdp[1:19] > y<-growth.cons[2:20] > reg1<-lm(y~x) > summary(reg1) Call: lm(formula = y ~ x) Residuals: Min 1Q Median 3Q Max Coefficients: Estimate Std. Error t value Pr(> t ) (Intercept) * x * --- Signif. codes: 0 `***' `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 Residual standard error: on 17 degrees of freedom Multiple R-Squared: , Adjusted R-squared: F-statistic: on 1 and 17 DF, p-value: GDP 1 19 GDP gdp[1:19] 25 cons[2:20] 25 29

30 lm( ) summary( ) lm( ) y ~ x ~ y~x 1 + x 2 + x 3 + GDP T % S Y = + T T T=1,2,3,.. > length(saving.rate) [1] 21 > trend<-seq(1,21) > reg1<-lm(saving.rate~trend) > summary(reg1) Call: lm(formula = saving.rate ~ trend) Residuals: Min 1Q Median 3Q Max 26 GDP R 30

31 Coefficients: Estimate Std. Error t value Pr(> t ) (Intercept) <2e-16 *** trend Signif. codes: 0 `***' `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 Residual standard error: on 19 degrees of freedom Multiple R-Squared: , Adjusted R-squared: F-statistic: on 1 and 19 DF, p-value: trend T gdpcons 1. read.table( ) gdpcons<-read.table("gdpcons.txt",header=t) scan( ) scan( ) gdpcons 29 read.table( ) 31

32 > x<-scan() 1: 1 2: 2 3: 5 4: 6 5: 8 6: 9 7: Read 6 items > x [1] scan() 1 x 30 R write( ) write( ) 31 write(t(x),"filename",ncol=ncol(x)) t(x) x 24 R 30 scan( ) help(scan) 31 R 32

33 32 R m2y <- function(x){ if((length(x) %% 12)!= 0) return("inconsistent Number of Data") n <- length(x) / 12 y <- 1:n for(i in 1:n){ b <- 12*(i-1)+1 e <- 12*(i-1)+12 y[i] <- mean(x[b:e]) } y } m2y.r R > source("m2y.r") x.month x.year<-m2y(x.month) m2y( ) 33 R R Save workspace image? OK.Rdata.Rdata R [File] [Source R code] OK 33

34 .Rdata.Rdata [File] [Load Workspace] [Save Workspace] [Save Workspace].Rdata.Rdata Rdata 34

35 YEAR GDP CONS

DAA09

DAA09 > summary(dat.lm1) Call: lm(formula = sales ~ price, data = dat) Residuals: Min 1Q Median 3Q Max -55.719-19.270 4.212 16.143 73.454 Coefficients: Estimate Std. Error t value Pr(> t ) (Intercept) 237.1326

More information

1 R Windows R 1.1 R The R project web R web Download [CRAN] CRAN Mirrors Japan Download and Install R [Windows 9

1 R Windows R 1.1 R The R project web   R web Download [CRAN] CRAN Mirrors Japan Download and Install R [Windows 9 1 R 2007 8 19 1 Windows R 1.1 R The R project web http://www.r-project.org/ R web Download [CRAN] CRAN Mirrors Japan Download and Install R [Windows 95 and later ] [base] 2.5.1 R - 2.5.1 for Windows R

More information

1 15 R Part : website:

1 15 R Part : website: 1 15 R Part 4 2017 7 24 4 : website: email: http://www3.u-toyama.ac.jp/kkarato/ [email protected] 1 2 2 3 2.1............................... 3 2.2 2................................. 4 2.3................................

More information

R John Fox R R R Console library(rcmdr) Rcmdr R GUI Windows R R SDI *1 R Console R 1 2 Windows XP Windows * 2 R R Console R ˆ R

R John Fox R R R Console library(rcmdr) Rcmdr R GUI Windows R R SDI *1 R Console R 1 2 Windows XP Windows * 2 R R Console R ˆ R R John Fox 2006 8 26 2008 8 28 1 R R R Console library(rcmdr) Rcmdr R GUI Windows R R SDI *1 R Console R 1 2 Windows XP Windows * 2 R R Console R ˆ R GUI R R R Console > ˆ 2 ˆ Fox(2005) [email protected]

More information

インターネットを活用した経済分析 - フリーソフト Rを使おう

インターネットを活用した経済分析 - フリーソフト Rを使おう 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

More information

Use R

Use R Use R! 2008/05/23( ) Index Introduction (GLM) ( ) R. Introduction R,, PLS,,, etc. 2. Correlation coefficient (Pearson s product moment correlation) r = Sxy Sxx Syy :, Sxy, Sxx= X, Syy Y 1.96 95% R cor(x,

More information

講義のーと : データ解析のための統計モデリング. 第3回

講義のーと :  データ解析のための統計モデリング. 第3回 Title 講義のーと : データ解析のための統計モデリング Author(s) 久保, 拓弥 Issue Date 2008 Doc URL http://hdl.handle.net/2115/49477 Type learningobject Note この講義資料は, 著者のホームページ http://hosho.ees.hokudai.ac.jp/~kub ードできます Note(URL)http://hosho.ees.hokudai.ac.jp/~kubo/ce/EesLecture20

More information

卒業論文

卒業論文 Y = ax 1 b1 X 2 b2...x k bk e u InY = Ina + b 1 InX 1 + b 2 InX 2 +...+ b k InX k + u X 1 Y b = ab 1 X 1 1 b 1 X 2 2...X bk k e u = b 1 (ax b1 1 X b2 2...X bk k e u ) / X 1 = b 1 Y / X 1 X 1 X 1 q YX1

More information

●70974_100_AC009160_KAPヘ<3099>ーシス自動車約款(11.10).indb

●70974_100_AC009160_KAPヘ<3099>ーシス自動車約款(11.10).indb " # $ % & ' ( ) * +, -. / 0 1 2 3 4 5 6 7 8 9 : ; < = >? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y " # $ % & ' ( ) * + , -. / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B

More information

untitled

untitled R [email protected] 1 Excel 1, 2.6, 2/3, 105.2, 0.0043 1, 3, 0, 245 A, B, C... ; 0 1 0.2, 3/4, 0.99 MS Excel»» R Macintosh MS Excel Excel Excel MS Excel MS Access Excel R R R R.Data win Mac ctrl + R Win,

More information

kubostat2017c p (c) Poisson regression, a generalized linear model (GLM) : :

kubostat2017c p (c) Poisson regression, a generalized linear model (GLM) : : kubostat2017c p.1 2017 (c), a generalized linear model (GLM) : [email protected] http://goo.gl/76c4i 2017 11 14 : 2017 11 07 15:43 kubostat2017c (http://goo.gl/76c4i) 2017 (c) 2017 11 14 1 / 47 agenda

More information

一般化線形 (混合) モデル (2) - ロジスティック回帰と GLMM

一般化線形 (混合) モデル (2) - ロジスティック回帰と GLMM .. ( ) (2) GLMM [email protected] I http://goo.gl/rrhzey 2013 08 27 : 2013 08 27 08:29 kubostat2013ou2 (http://goo.gl/rrhzey) ( ) (2) 2013 08 27 1 / 74 I.1 N k.2 binomial distribution logit link function.3.4!

More information

2.1 R, ( ), Download R for Windows base. R ( ) R win.exe, 2.,.,.,. R > 3*5 # [1] 15 > c(19,76)+c(11,13)

2.1 R, ( ),   Download R for Windows base. R ( ) R win.exe, 2.,.,.,. R > 3*5 # [1] 15 > c(19,76)+c(11,13) 3 ( ) R 3 1 61, 2016/4/7( ), 4/14( ), 4/21( ) 1 1 2 1 2.1 R, ( )................ 2 2.2 ggm............................ 3 2.3,................ 4 2.4...................................... 6 2.5 1 ( )....................

More information

講義のーと : データ解析のための統計モデリング. 第2回

講義のーと :  データ解析のための統計モデリング. 第2回 Title 講義のーと : データ解析のための統計モデリング Author(s) 久保, 拓弥 Issue Date 2008 Doc URL http://hdl.handle.net/2115/49477 Type learningobject Note この講義資料は, 著者のホームページ http://hosho.ees.hokudai.ac.jp/~kub ードできます Note(URL)http://hosho.ees.hokudai.ac.jp/~kubo/ce/EesLecture20

More information

R R-console R R Rscript R-console GUI 1

R R-console R R Rscript R-console GUI 1 November 2015 R R-console R R Rscript R-console GUI 1 2 X Y 1 11.04 21.03 2 15.76 24.75 3 17.72 31.28 4 9.15 11.16 5 10.10 18.89 6 12.33 24.25 7 4.20 10.57 8 17.04 33.99 9 10.50 21.01 10 8.36 9.68 x =

More information

こんにちは由美子です

こんにちは由美子です Analysis of Variance 2 two sample t test analysis of variance (ANOVA) CO 3 3 1 EFV1 µ 1 µ 2 µ 3 H 0 H 0 : µ 1 = µ 2 = µ 3 H A : Group 1 Group 2.. Group k population mean µ 1 µ µ κ SD σ 1 σ σ κ sample mean

More information

¥¤¥ó¥¿¡¼¥Í¥Ã¥È·×¬¤È¥Ç¡¼¥¿²òÀÏ Âè2²ó

¥¤¥ó¥¿¡¼¥Í¥Ã¥È·×¬¤È¥Ç¡¼¥¿²òÀÏ Âè2²ó 2 2015 4 20 1 (4/13) : ruby 2 / 49 2 ( ) : gnuplot 3 / 49 1 1 2014 6 IIJ / 4 / 49 1 ( ) / 5 / 49 ( ) 6 / 49 (summary statistics) : (mean) (median) (mode) : (range) (variance) (standard deviation) 7 / 49

More information

kubostat2017e p.1 I 2017 (e) GLM logistic regression : : :02 1 N y count data or

kubostat2017e p.1 I 2017 (e) GLM logistic regression : : :02 1 N y count data or kubostat207e p. I 207 (e) GLM [email protected] https://goo.gl/z9ycjy 207 4 207 6:02 N y 2 binomial distribution logit link function 3 4! offset kubostat207e (https://goo.gl/z9ycjy) 207 (e) 207 4

More information

講義のーと : データ解析のための統計モデリング. 第5回

講義のーと :  データ解析のための統計モデリング. 第5回 Title 講義のーと : データ解析のための統計モデリング Author(s) 久保, 拓弥 Issue Date 2008 Doc URL http://hdl.handle.net/2115/49477 Type learningobject Note この講義資料は, 著者のホームページ http://hosho.ees.hokudai.ac.jp/~kub ードできます Note(URL)http://hosho.ees.hokudai.ac.jp/~kubo/ce/EesLecture20

More information

Stata11 whitepapers mwp-037 regress - regress regress. regress mpg weight foreign Source SS df MS Number of obs = 74 F(

Stata11 whitepapers mwp-037 regress - regress regress. regress mpg weight foreign Source SS df MS Number of obs = 74 F( mwp-037 regress - regress 1. 1.1 1.2 1.3 2. 3. 4. 5. 1. regress. regress mpg weight foreign Source SS df MS Number of obs = 74 F( 2, 71) = 69.75 Model 1619.2877 2 809.643849 Prob > F = 0.0000 Residual

More information

R による共和分分析 1. 共和分分析を行う 1.1 パッケージ urca インスツールする 共和分分析をするために R のパッケージ urca をインスツールする パッケージとは通常の R には含まれていない 追加的な R のコマンドの集まりのようなものである R には追加的に 600 以上のパッ

R による共和分分析 1. 共和分分析を行う 1.1 パッケージ urca インスツールする 共和分分析をするために R のパッケージ urca をインスツールする パッケージとは通常の R には含まれていない 追加的な R のコマンドの集まりのようなものである R には追加的に 600 以上のパッ R による共和分分析 1. 共和分分析を行う 1.1 パッケージ urca インスツールする 共和分分析をするために R のパッケージ urca をインスツールする パッケージとは通常の R には含まれていない 追加的な R のコマンドの集まりのようなものである R には追加的に 600 以上のパッケージが用意されており それぞれ分析の目的に応じて標準の R にパッケージを追加していくことになる インターネットに接続してあるパソコンで

More information

R による統計解析入門

R による統計解析入門 R May 31, 2016 R R R R Studio GUI R Console R Studio PDF URL http://ruby.kyoto-wu.ac.jp/konami/text/r R R Console Windows, Mac GUI Unix R Studio GUI R version 3.2.3 (2015-12-10) -- "Wooden Christmas-Tree"

More information

回帰分析 単回帰

回帰分析 単回帰 回帰分析 単回帰 麻生良文 単回帰モデル simple regression model = α + β + u 従属変数 (dependent variable) 被説明変数 (eplained variable) 独立変数 (independent variable) 説明変数 (eplanator variable) u 誤差項 (error term) 撹乱項 (disturbance term)

More information

201711grade2.pdf

201711grade2.pdf 2017 11 26 1 2 28 3 90 4 5 A 1 2 3 4 Web Web 6 B 10 3 10 3 7 34 8 23 9 10 1 2 3 1 (A) 3 32.14 0.65 2.82 0.93 7.48 (B) 4 6 61.30 54.68 34.86 5.25 19.07 (C) 7 13 5.89 42.18 56.51 35.80 50.28 (D) 14 20 0.35

More information

PackageSoft/R-033U.tex (2018/March) R:

PackageSoft/R-033U.tex (2018/March) R: ................................................................................ R: 2018 3 29................................................................................ R AI R https://cran.r-project.org/doc/contrib/manuals-jp/r-intro-170.jp.pdf

More information

1 2 Windows 7 *3 Windows * 4 R R Console R R Console ˆ R GUI R R R *5 R 2 R R R 6.1 ˆ 2 ˆ 2 ˆ Graphics Device 1 Rcmdr R Console R Rconsole R --sdi R M

1 2 Windows 7 *3 Windows * 4 R R Console R R Console ˆ R GUI R R R *5 R 2 R R R 6.1 ˆ 2 ˆ 2 ˆ Graphics Device 1 Rcmdr R Console R Rconsole R --sdi R M R John Fox and Milan Bouchet-Valat Version 2.0-1 2013 11 8 2013 11 11 1 R Fox 2005 R R Core Team, 2013 GUI R R R R R R R R R the Comprehensive R Archive Network (CRAN) R CRAN 6.4 R Windows R Rcmdr Mac

More information

kubostat2018d p.2 :? bod size x and fertilization f change seed number? : a statistical model for this example? i response variable seed number : { i

kubostat2018d p.2 :? bod size x and fertilization f change seed number? : a statistical model for this example? i response variable seed number : { i kubostat2018d p.1 I 2018 (d) model selection and [email protected] http://goo.gl/76c4i 2018 06 25 : 2018 06 21 17:45 1 2 3 4 :? AIC : deviance model selection misunderstanding kubostat2018d (http://goo.gl/76c4i)

More information

<4D F736F F F696E74202D BD95CF97CA89F090CD F6489F18B4195AA90CD816A>

<4D F736F F F696E74202D BD95CF97CA89F090CD F6489F18B4195AA90CD816A> 主な多変量解析 9. 多変量解析 1 ( 重回帰分析 ) 目的変数 量的 説明変数 質的 あり量的 重回帰分析 数量化 Ⅰ 類 質的 判別分析 数量化 Ⅱ 類 なし 主成分分析因子分析多次元尺度構成法 数量化 Ⅲ 類数量化 Ⅳ 類 その他 クラスタ分析共分散構造分析 説明変数 : 独立変数 予測変数 目的変数 : 従属変数 基準変数 3 1. 単回帰分析各データの構造 y b ax a α: 1,,,

More information

こんにちは由美子です

こんにちは由美子です 1 2 . sum Variable Obs Mean Std. Dev. Min Max ---------+----------------------------------------------------- var1 13.4923077.3545926.05 1.1 3 3 3 0.71 3 x 3 C 3 = 0.3579 2 1 0.71 2 x 0.29 x 3 C 2 = 0.4386

More information

第11回:線形回帰モデルのOLS推定

第11回:線形回帰モデルのOLS推定 11 OLS 2018 7 13 1 / 45 1. 2. 3. 2 / 45 n 2 ((y 1, x 1 ), (y 2, x 2 ),, (y n, x n )) linear regression model y i = β 0 + β 1 x i + u i, E(u i x i ) = 0, E(u i u j x i ) = 0 (i j), V(u i x i ) = σ 2, i

More information

「統 計 数 学 3」

「統 計 数 学 3」 関数の使い方 1 関数と引数 関数の構造 関数名 ( 引数 1, 引数 2, 引数 3, ) 例 : マハラノビス距離を求める関数 mahalanobis(data,m,v) 引数名を指定して記述する場合 mahalanobis(x=data, center=m, cov=v) 2 関数についてのヘルプ 基本的な関数のヘルプの呼び出し? 関数名 例 :?mean 例 :?mahalanobis 指定できる引数を確認する関数

More information

<4D F736F F D20939D8C7689F090CD985F93C18EEA8D758B E646F63>

<4D F736F F D20939D8C7689F090CD985F93C18EEA8D758B E646F63> Gretl OLS omitted variable omitted variable AIC,BIC a) gretl gretl sample file Greene greene8_3 Add Define new variable l_g_percapita=log(g/pop) Pg,Y,Pnc,Puc,Ppt,Pd,Pn,Ps Add logs of selected variables

More information

- 1 - - 2 - 320 421 928 1115 12 8 116 124 2 7 4 5 428 515 530 624 921 1115 1-3 - 100 250-4 - - 5 - - 6 - - 7 - - 8 - - 9 - & & - 11 - - 12 - GT GT - 13 - GT - 14 - - 15 - - 16 - - 17 - - 18 - - 19 - -

More information

00 0 0 0 0 0 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.... 0........ 0 0 0 0 0 0 0 0 0 0..0..........0 0 0 0 0 0 0 0 0 0 0.... 0........ 0 0 0 0 0 0 0 0 0 0... 0...... 0... 0 0 0 0 0 0..0 0... 0 0 0 0 0.0.....0.

More information

76

76 ! # % & % & %& %& " $ 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 % & &! & $ & " & $ & # & ' 91 92 $ % $'%! %(% " %(% # &)% & 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 !$!$ "% "%

More information

k3 ( :07 ) 2 (A) k = 1 (B) k = 7 y x x 1 (k2)?? x y (A) GLM (k

k3 ( :07 ) 2 (A) k = 1 (B) k = 7 y x x 1 (k2)?? x y (A) GLM (k 2012 11 01 k3 (2012-10-24 14:07 ) 1 6 3 (2012 11 01 k3) [email protected] web http://goo.gl/wijx2 web http://goo.gl/ufq2 1 3 2 : 4 3 AIC 6 4 7 5 8 6 : 9 7 11 8 12 8.1 (1)........ 13 8.2 (2) χ 2....................

More information

: (EQS) /EQUATIONS V1 = 30*V F1 + E1; V2 = 25*V *F1 + E2; V3 = 16*V *F1 + E3; V4 = 10*V F2 + E4; V5 = 19*V99

: (EQS) /EQUATIONS V1 = 30*V F1 + E1; V2 = 25*V *F1 + E2; V3 = 16*V *F1 + E3; V4 = 10*V F2 + E4; V5 = 19*V99 218 6 219 6.11: (EQS) /EQUATIONS V1 = 30*V999 + 1F1 + E1; V2 = 25*V999 +.54*F1 + E2; V3 = 16*V999 + 1.46*F1 + E3; V4 = 10*V999 + 1F2 + E4; V5 = 19*V999 + 1.29*F2 + E5; V6 = 17*V999 + 2.22*F2 + E6; CALIS.

More information

-34-

-34- -33- -34- ! -35- ! -36- ! -37- -38- -39- -40- -41- -42- -43- -44- -45- -46- -47- -48- -49- -50- ! -51- -52- !! -53- -54- ! -55- -56- -57- !!!!! "" "!!! " "" " -58- -59- !!! -60- -61- -62- -63- ! -64- !

More information

2 R 1 2.1 2.1: R R [ 1.1] [ 2.1] R R R plot() contour() 2

2 R 1 2.1 2.1: R R [ 1.1] [ 2.1] R R R plot() contour() 2 1 R for Windows R Windows Mac OS X Linux Windows 1.1 1.2 R R cat( n ) R R-00.0(00.0 ) etc Rconsole font=tt Courier New font = TT MS Gothic points = 10 points = 14 Rdevga TT Arial TT MS Gothic R demo(japanese)

More information

最小2乗法

最小2乗法 2 2012 4 ( ) 2 2012 4 1 / 42 X Y Y = f (X ; Z) linear regression model X Y slope X 1 Y (X, Y ) 1 (X, Y ) ( ) 2 2012 4 2 / 42 1 β = β = β (4.2) = β 0 + β (4.3) ( ) 2 2012 4 3 / 42 = β 0 + β + (4.4) ( )

More information

第9回 日経STOCKリーグレポート 審査委員特別賞<地域の元気がでるで賞>

第9回 日経STOCKリーグレポート 審査委員特別賞<地域の元気がでるで賞> 1/21 1 2 3 1 2 3 4 5 4 5 6 2/21 2 3 2 4 5 6 3/21 38 38 4 2007 10 471 10 10 () () () OKI () () () () () 1989 2008 4 13 10 10 1 2 3 4 1 3 1 4/21 2 3 3 2 5/21 3 100 1.5 1/2 4 () 1991 2002 10 3 1 6/21 10 6

More information

2 と入力すると以下のようになる > x1<-c(1.52,2,3.01,9,2,6.3,5,11.2) > y1<-c(4,0.21,-1.5,8,2,6,9.915,5.2) > cor(x1,y1) [1] > cor.test(x1,y1) Pearson's produ

2 と入力すると以下のようになる > x1<-c(1.52,2,3.01,9,2,6.3,5,11.2) > y1<-c(4,0.21,-1.5,8,2,6,9.915,5.2) > cor(x1,y1) [1] > cor.test(x1,y1) Pearson's produ 1 統計 データ解析セミナーの予習 2010.11.24 粕谷英一 ( 理 生物 生態 ) GCOE アジア保全生態学 本日のメニュー R 一般化線形モデル (Generalized Linear Models 略して GLM) R で GLM を使う R でグラフを描く 説明しないこと :R でできること全般 たくさんあるので時間的に無理 R でするプログラミング-データ解析なら使いやすい R 起動と終了

More information

% 10%, 35%( 1029 ) p (a) 1 p 95% (b) 1 Std. Err. (c) p 40% 5% (d) p 1: STATA (1). prtesti One-sample test of pr

% 10%, 35%( 1029 ) p (a) 1 p 95% (b) 1 Std. Err. (c) p 40% 5% (d) p 1: STATA (1). prtesti One-sample test of pr 1 1. 2014 6 2014 6 10 10% 10%, 35%( 1029 ) p (a) 1 p 95% (b) 1 Std. Err. (c) p 40% 5% (d) p 1: STATA (1). prtesti 1029 0.35 0.40 One-sample test of proportion x: Number of obs = 1029 Variable Mean Std.

More information

σ t σ t σt nikkei HP nikkei4csv H R nikkei4<-readcsv("h:=y=ynikkei4csv",header=t) (1) nikkei header=t nikkei4csv 4 4 nikkei nikkei4<-dataframe(n

σ t σ t σt nikkei HP nikkei4csv H R nikkei4<-readcsv(h:=y=ynikkei4csv,header=t) (1) nikkei header=t nikkei4csv 4 4 nikkei nikkei4<-dataframe(n R 1 R R R tseries fseries 1 tseries fseries R Japan(Tokyo) R library(tseries) library(fseries) 2 t r t t 1 Ω t 1 E[r t Ω t 1 ] ɛ t r t = E[r t Ω t 1 ] + ɛ t ɛ t 2 iid (independently, identically distributed)

More information

270万回再生レポート

270万回再生レポート 270 270 2 2 Keynote(Mac) Camtasia PC VIdeo5 Point 2 Point 15 2 Point Point ) (2 2 3 2 3 Point 2 4 3 2 1 OK 100 4 10 20 2 75% Point 4 3 SEX Point SEX SEX SEX 2 SEX Point 2 2500 Point ( 100 Point

More information

以下の内容について説明する 1. VAR モデル推定する 2. VAR モデルを用いて予測する 3. グレンジャーの因果性を検定する 4. インパルス応答関数を描く 1. VAR モデルを推定する ここでは VAR(p) モデル : R による時系列分析の方法 2 y t = c + Φ 1 y t

以下の内容について説明する 1. VAR モデル推定する 2. VAR モデルを用いて予測する 3. グレンジャーの因果性を検定する 4. インパルス応答関数を描く 1. VAR モデルを推定する ここでは VAR(p) モデル : R による時系列分析の方法 2 y t = c + Φ 1 y t 以下の内容について説明する 1. VAR モデル推定する 2. VAR モデルを用いて予測する 3. グレンジャーの因果性を検定する 4. インパルス応答関数を描く 1. VAR モデルを推定する ここでは VAR(p) モデル : R による時系列分析の方法 2 y t = c + Φ 1 y t 1 + + Φ p y t p + ε t, ε t ~ W.N(Ω), を推定することを考える (

More information

ワードプロセッシングについて

ワードプロセッシングについて Word Word ONOFF (U)(P) ******** 1 OS Windows2000 Windows2000 (U) OK 2 Windows 3 Word 1) 2) (F)(O) A() FD(A) Word 4 1) / > < *.? " : ; 2) SAMPLE2 A SAMPLE2 5 .doc 6 Alt f6f9 7 + 8 ) 2) 9 1) 2) 1) 10 2)

More information

1 1 ( ) ( 1.1 1.1.1 60% mm 100 100 60 60% 1.1.2 A B A B A 1

1 1 ( ) ( 1.1 1.1.1 60% mm 100 100 60 60% 1.1.2 A B A B A 1 1 21 10 5 1 E-mail: [email protected] 1 1 ( ) ( 1.1 1.1.1 60% mm 100 100 60 60% 1.1.2 A B A B A 1 B 1.1.3 boy W ID 1 2 3 DI DII DIII OL OL 1.1.4 2 1.1.5 1.1.6 1.1.7 1.1.8 1.2 1.2.1 1. 2. 3 1.2.2

More information

untitled

untitled StiLL StiLL Excel VBA IT Excel2000 2003 StiLL StiLL! Excel2007 StiLL -- -- Excel!!!! DB CSV VBA VBA ' VBA Public Sub SampleProgramDAO1() Dim SheetName As String Dim strname As String SheetName = "Sheet2"

More information