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

Similar documents
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 Commanderを用いたデータ解析

DAA09

Rによる計量分析:データ解析と可視化 - 第2回 セットアップ

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

201711grade2.pdf

Use R

1 15 R Part : website:

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

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

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

(2/24) : 1. R R R

Rによる計量分析:データ解析と可視化 - 第3回 Rの基礎とデータ操作・管理

fiš„v8.dvi

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

こんにちは由美子です

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

% 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

<4D F736F F D20939D8C7689F090CD985F93C18EEA8D758B E646F63>

Œ¼‘ÌŒ¢’Ý™è-1

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

Stata 11 Stata ROC whitepaper mwp anova/oneway 3 mwp-042 kwallis Kruskal Wallis 28 mwp-045 ranksum/median / 31 mwp-047 roctab/roccomp ROC 34 mwp-050 s

第13回:交差項を含む回帰・弾力性の推定

最小2乗法

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

kubostat2017b p.1 agenda I 2017 (b) probability distribution and maximum likelihood estimation :

R による統計解析入門

Microsoft Word - 計量研修テキスト_第5版).doc

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

: (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

!!! 2!

1 I EViews View Proc Freeze

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

1 Stata SEM LightStone 4 SEM 4.. Alan C. Acock, Discovering Structural Equation Modeling Using Stata, Revised Edition, Stata Press 3.

.3 ˆβ1 = S, S ˆβ0 = ȳ ˆβ1 S = (β0 + β1i i) β0 β1 S = (i β0 β1i) = 0 β0 S = (i β0 β1i)i = 0 β1 β0, β1 ȳ β0 β1 = 0, (i ȳ β1(i ))i = 0 {(i ȳ)(i ) β1(i ))

Solution Report

1 1.1 PC PC PC PC PC workstation PC hardsoft PC PC CPU 1 Gustavb, Wikimedia Commons.

回帰分析 単回帰

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

Introduction Purpose This training course demonstrates the use of the High-performance Embedded Workshop (HEW), a key tool for developing software for

統計研修R分散分析(追加).indd

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

<4D F736F F F696E74202D BD95CF97CA89F090CD F6489F18B4195AA90CD816A>

Microsoft Word - 計量研修テキスト_第5版).doc

EPSON ES-D200 パソコンでのスキャンガイド

untitled

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

2.2 Sage I 11 factor Sage Sage exit quit 1 sage : exit 2 Exiting Sage ( CPU time 0m0.06s, Wall time 2m8.71 s). 2.2 Sage Python Sage 1. Sage.sage 2. sa


卒業論文

JavaScript の使い方

σ 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

1 Stata SEM LightStone 3 2 SEM. 2., 2,. Alan C. Acock, Discovering Structural Equation Modeling Using Stata, Revised Edition, Stata Press.

MathLibre KNOPPIX (next generation) 2012 KNOPPIX/Math MathLibre KNOPPIX , KNOPPIX 6.0, next generation. KNOPPIX/Math KDE,

4.9 Hausman Test Time Fixed Effects Model vs Time Random Effects Model Two-way Fixed Effects Model

JP1/Integrated Management - Service Support 操作ガイド

101NEO資料

(2 Linux Mozilla [ ] [ ] [ ] [ ] URL 2 qkc, nkc ~/.cshrc (emacs 2 set path=($path /usr/meiji/pub/linux/bin tcsh b

と入力する すると最初の 25 行が表示される 1 行目は変数の名前であり 2 列目は企業番号 (1,,10),3 列目は西暦 (1935,,1954) を表している ( 他のパネルデータを分析する際もデ ータをこのように並べておかなくてはならない つまりまず i=1 を固定し i=1 の t に関

debian_install.dvi

i I Excel iii Excel Excel Excel

オーストラリア研究紀要 36号(P)☆/3.橋本

66-1 田中健吾・松浦紗織.pwd

RとExcelを用いた分布推定の実践例

ES-D400/ES-D350

programmingII2019-v01

LiveCode初心者開発入門サンプル

Transcription:

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 OS X Linux Unix R OS R R <http://socserv.socsci.mcmaster.ca/jfox/misc/rcmdr/index.html>, <tinyurl.com/rcmdr> Windows R Rcmdr GUI R * 1 2 R R R Console library(rcmdr) Rcmdr R GUI Windows R R SDI *2 R Console R Fox(2005) jfox@mcmaster.ca R-3.0.2 Rcmdr 2.0-1 arakit@kansai-u.ac.jp *1 ( ) *2 R Windows MDIR Console R 1 SDIR Console R SDI R etc 1

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 MDI R *3 ( ) Windows 8 *4 Rcmdr R Rcmdr Rcmdr Comprehensive R Archive Network (CRAN) <http://cran.r-project.org/> R CD-ROMWindows R GUI Rcmdr Rcmdr install.packages Rcmdr dependencies = TRUE Dirk Eddelbuettel Debian Linux $ apt-get install r-cran-rcmdr Rcmdr Linux Rcmdr Mac OS X Rcmdr tcltk X-Windows Tcl/Tk X-Windows R *5 R Console > R 2

2 R R Rcmdr Rcmdr Fox, 2007 Fox and Carvalho, 2012 6.4 R R R 2.0-0 3

* 6 Rcmdr R R R R R R R knitr knitr *6 R R Windows R dividers... 4

Rcmdr URL SPSS SAS Minitab STATA Excel Access dbase [32-bit Windows ] Excel [64-bit Windows ] () 5

Rcmdr F k- 6

Rcmdr QQ 3 3 PDF/Postscript/EPS RGL 7

Rcmdr AIC BIC RESET QQ 8

Rcmdr F F F F F 9

Rcmdr Rcmdr 2 2 2 2 2 2 2 2 2 2 2 Rcmdr Rcmdr Commander R R Rcmdr R R R R 10

ˆ 2 R 2 * 7 2 R ˆ R GUI R Ctrl-r *8 Ctrl-Tab R Ctrl-a Ctrl-s ˆ R R R Console ˆ Rcmdr R Console R R R... R * 9 Rcmdr R 3 R * 10 1 R *7 David Firth relimp showdata 100R View R View 0 R *8 Ctrl Control r *9... GUI *10 11

R * 11 ˆ Mac OS X... ˆ ascii URL Minitab SPSS StataWindowsExcel Access dbase ˆ R 3.1 Nations.txt * 12 TFR contraception infant.mortality GDP region Afghanistan 6.90 NA 154 2848 Asia Albania 2.60 NA 32 863 Europe Algeria 3.81 52 44 1531 Africa American-Samoa NA NA 11 NA Oceania Andorra NA NA NA NA Europe Angola 6.69 NA 124 355 Africa Antigua NA 53 24 6966 Americas Argentina 2.62 NA 22 8055 Americas Armenia 1.70 22 25 354 Europe Australia 1.89 76 6 20046 Oceania... ˆ 1 TFR 1 contraception ( ) infant.mortality 1000 GDP 1 US region ˆ 2 1 5 6 R read.table ˆ R NA not available ˆ TFR contraception infant.mortality GDP region R region R Nations.txt R R URL... 3 *11 *12 Rcmdr etc 12

URL Nations 3 R. 0 9 R nations Nations NATIONS OK 4 Nations.txt R 5 R 5 Nations read.table showdatar R relimp library read.table R R R 3.2 R * 13 (2000) Problem 2.44 Moore ˆ R... Problem2.44 OK R *13 R Mac OS X URL... 13

4 5 ˆ 2 Enter 6 ˆ 1 var1 7 ˆ age Enter 2 height 14

8 ˆ R 6 7 3.3 R * 14 9 * 15 R *14 R *15 R 15

8 2 9 car Prestige 4 R GUI R Nations Moore (2000) 5 car Prestige R 10 TFR contraception infant.mortality GDP 1 3 region 10 R R 11 region infant.mortality * 16 2 *16 1 2 16

12 OK > numsummary(nations[,"infant.mortality"], statistics=c("mean", "sd", "IQR", + "quantiles"), quantiles=c(0,.25,.5,.75,1)) mean sd IQR 0% 25% 50% 75% 100% n NA 43.47761 38.75604 54 2 12 30 66 169 201 6 sdiqr 0 1 3 100 n NA R 11 OK * 17 R R OK R OK... 12 Nations 1 region OK... region 14 2 GDP infant.mortality OK > numsummary(nations[,c("gdp", "infant.mortality")], groups=nations$region, + statistics=c("mean", "sd", "IQR", "quantiles"), quantiles=c(0,.25,.5,.75,1)) Variable: GDP mean sd IQR 0% 25% 50% 75% 100% n NA Africa 1196.000 2089.614 795.50 36 209.00 389.5 1004.50 11854 54 1 Americas 5398.000 6083.311 5268.50 386 1749.25 2765.5 7017.75 26037 40 1 Asia 4505.051 6277.738 6062.50 122 345.00 1079.0 6407.50 22898 39 2 Europe 13698.909 13165.412 24582.25 271 1643.75 9222.5 26226.00 42416 44 1 Oceania 8732.600 11328.708 16409.25 654 1102.75 2348.5 17512.00 41718 20 5 Variable: infant.mortality mean sd IQR 0% 25% 50% 75% 100% n NA Africa 85.27273 35.188095 50.0 7 61.00 85.0 111.00 169 55 0 Americas 25.60000 17.439713 24.0 6 12.00 21.5 36.00 82 40 1 Windows Shift Ctrl *17 17

Asia 45.65854 32.980001 50.0 5 22.00 37.0 72.00 154 41 0 Europe 11.85366 7.122363 10.0 5 6.00 8.0 16.00 32 41 4 Oceania 27.79167 29.622229 26.5 2 9.25 20.0 35.75 135 24 1 R 10 11 R R... 15 infant.mortality OK 16 18

12 13 14 region 2 1 * 18 *18 Windows Windows R Page Up Page Down Windows 3 3... 3 RGL Fox, 2003 Fox and Hong 2009 19

15 16 Nations infant.mortality 5 R...... 2 Venables and Ripley (2002) 2 nnet MASS 17 * 19 *19 R R 20

... Prestige Prestige Prestige 3.3 car 17 ˆ ˆ ˆ ˆ log(income) ˆ LinearModel.1 ˆ R lm subset 1 TRUE FALSE type!= "prof" Prestige prof OK LinearModel.1 > LinearModel.1 <- lm(prestige ~ (education + log(income ))*type, data=prestige) > summary(linearmodel.1) Introduction to R R Console PDF 21

Call: lm(formula = prestige ~ (education + log(income)) * type, data = Prestige) Residuals: Min 1Q Median 3Q Max -13.970-4.124 1.206 3.829 18.059 Coefficients: Estimate Std. Error t value Pr(> t ) (Intercept) -120.0459 20.1576-5.955 5.07e-08 *** education 2.3357 0.9277 2.518 0.01360 * log(income) 15.9825 2.6059 6.133 2.32e-08 *** type[t.prof] 85.1601 31.1810 2.731 0.00761 ** type[t.wc] 30.2412 37.9788 0.796 0.42800 education:type[t.prof] 0.6974 1.2895 0.541 0.58998 education:type[t.wc] 3.6400 1.7589 2.069 0.04140 * log(income):type[t.prof] -9.4288 3.7751-2.498 0.01434 * log(income):type[t.wc] -8.1556 4.4029-1.852 0.06730. --- Signif. codes: 0 *** 0.001 ** 0.01 * 0.05. 0.1 1 Residual standard error: 6.409 on 89 degrees of freedom (4 observations deleted due to missingness) Multiple R-squared: 0.871,Adjusted R-squared: 0.8595 F-statistic: 75.15 on 8 and 89 DF, p-value: < 2.2e-16 Type II > Anova(LinearModel.1, type="ii") Anova Table (Type II tests) Response: prestige Sum Sq Df F value Pr(>F) education 1209.3 1 29.4446 4.912e-07 *** log(income) 1690.8 1 41.1670 6.589e-09 *** type 469.1 2 5.7103 0.004642 ** education:type 178.8 2 2.1762 0.119474 log(income):type 290.3 2 3.5344 0.033338 * Residuals 3655.4 89 --- Signif. codes: 0 *** 0.001 ** 0.01 * 0.05. 0.1 1 22

6 6.1 R R R 18 R R R HTML R R * 20 R R R * 21 {r}r R R R {r echo=false}) R knitr Xie 2013... R <!-- R Commander Markdown Template --> Replace with Main Title ======================= ### Your Name ### r as.character(sys.date()) {r echo=false} # include this code chunk as-is to set options opts_chunk$set(comment=na, prompt=true, out.width=750, fig.height=8, fig.width=8) library(rcmdr) {r} Nations <- read.table("c:/r/r-3.0.1patched/library/rcmdr/etc/nations.txt", header=true, sep="", na.strings="na", dec=".", strip.white=true) *20 *21 R 23

... {r} data(prestige, package="car")... Let us regress occupational prestige on the education and income levels of the occupations, transforming income to linearize its relationship to prestige: {r} LinearModel.1 <- lm(prestige ~ (education + log(income))*type, data=prestige) summary(linearmodel.1) Anova(LinearModel.1, type="ii") Your Name Replace with Main Title R {r} R * *this is important* Let us regress occupational prestige... prestige... R R HTML HTML R R ( 18 R R R R R Ctrl-E R HTML OK R 6.2 R R R R 24

18 R R Word OpenOffice Writer Windows WordPad Ctrl-c Ctrl-v 1 R Courier New R Ctrl-v Ctrl-w R * 22 R R R R *22 Windows 25

6.3 R R R R R Windows Mac OS X RStudio <www.rstudio.org> * 23 6.4 R R R R CRAN R R R R Rcmdr R 6.5 R R R R R R Console R R [1] Firth, D. (2011). relimp: Relative Contribution of Effects in a Regression Model. R package version 1.0-3. [2] Fox, J. (2003). Effect displays in R for generalised linear models. Journal of Statistical Software, 8(15):1-27. [3] Fox, J. (2005). The R Commander: A basic-statistics graphical user interface to R. Journal of Statistical Software, 19(9):1-42. [4] Fox, J. (2007). Extending the Rcmdr by plug-in Packages. R News, 7(3):46-52. [5] Fox, J. and Sá Carvalho, M. (2012). The RcmdrPlugin.survival package: Extending the R Commander to survival analysis. Journal of Statistical Software, 49(7):1-32. [6] Moore, D. S. (2000). The Basic Practice of Statistics. Freeman, New York, second edition. [7] Venables, W. N. and Ripley, B. D. (2002). Modern Applied Statistics with S. Springer, New York, fourth edition. *23 R RStudio R RStudio R RStudio 26

[8] Xie, Y. (2013). knitr: A general-purpose package for dynamic report generation in R. R package version 1.2. 27