《multilevel modeling in r》由会员分享,可在线阅读,更多相关《multilevel modeling in r(85页珍藏版)》请在金锄头文库上搜索。
1、 Multilevel Modeling in R (2.4) A Brief Introduction to R, the multilevel package and the nlme package Paul Bliese (paul.blieseus.army.mil) April 10, 2012 Multilevel Models in R 2 Copyright 2012, Paul Bliese. Permission is granted to make and distribute verbatim copies of this document provided the
2、copyright notice and this permission notice are preserved on all copies. For other permissions, please contact Paul Bliese at paul.blieseus.army.mil. Chapters 1 and 2 of this document of this document borrow heavily from An Introduction to R (see the copyright notice below) An Introduction to R Note
3、s on R: A Programming Environment for Data Analysis and Graphics Version 1.1.1 (2000 August 15) R Development Core Team. Copyright c 1990, 1992 W. Venables Copyright c 1997, R. Gentleman numbers and vectors . 9 2.2.1 Vectors and assignment . 9 2.2.2 Missing values . 10 2.3 Dataframes . 10 2.3.1 Intr
4、oduction to dataframes . 10 2.3.2 Making dataframes. 11 2.3.3 Using attach() and detach() . 11 2.3.4 Managing the search path . 12 2.4 Reading data from files . 13 2.4.1 Reading Spreadsheet (EXCEL) data . 13 2.4.2 The extremely useful “clipboard“ option . 14 2.4.3 The foreign package and SPSS files
5、. 15 2.4.4 Using file.choose to bring up a GUI to read data . 17 2.4.5 Checking your dataframes with str , summary, and head . 18 2.4.6 Loading data from packages . 19 2.4.7 Exporting data to spreadsheets using write() and write.table() . 19 2.5 More on using matrix brackets on dataframes . 20 2.6 I
6、dentifying Statistical models in R . 21 2.6.1 Examples . 21 2.6.2 Linear models. 22 2.6.3 Generic functions for extracting model information . 22 2.7 Graphical procedures . 23 2.7.1 The plot() function . 23 2.7.2 Displaying multivariate data . 23 2.7.3 Advanced Graphics and the lattice package . 24
7、3 Multilevel Analyses. 26 3.1 Attaching the multilevel and nlme packages . 26 3.2 Helpful multilevel data manipulation functions . 26 3.2.1 The merge Function . 26 3.2.2 The aggregate function . 28 3.3 Within-Group Agreement and Reliability . 29 3.3.1 Agreement: rwg, rwg(j), and r*wg(j) . 30 3.3.2 The awg Index . 33 Multilevel Models in R 4 3.3.3 Significance testing of rwg and rwg(j) using rwg.sim and rwg.j.sim . 34 3.3.4 Average Deviation (AD) Agreement using ad.m .