An Introduction To S And The Hmisc And Design Libraries-Books Pdf

An Introduction to S and the Hmisc and Design Libraries
23 May 2020 | 4 views | 0 downloads | 310 Pages | 2.23 MB

Share Pdf : An Introduction To S And The Hmisc And Design Libraries

Download and Preview : An Introduction To S And The Hmisc And Design Libraries

Report CopyRight/DMCA Form For : An Introduction To S And The Hmisc And Design Libraries


Updates to this document may be obtained from biostat mc vanderbilt edu RS sintro pdf. 1 Introduction 1,1 1 S S Plus R and Source References 1. 1 2 Starting S 4,1 2 1 UNIX Linux 4,1 2 2 Windows 5. 1 3 Commands vs GUIs 7,1 4 Basic S Commands 7,1 5 Methods for Entering and Saving S Commands 9. 1 5 1 Specifying System File Names in S 11,1 6 Differences Between S and SAS 11. 1 7 A Comparison of UNIX Linux and Windows for Running S 18. 1 8 System Requirements 19,1 9 Some Useful System Tools 19.
2 Objects Getting Help Functions Attributes and Libraries 25. 2 1 Objects 25,2 2 Getting Help 25,2 3 Functions 29. 2 4 Vectors 30,2 4 1 Numeric Character and Logical Vectors 31. 2 4 2 Missing Values and Logical Comparisons 32,2 4 3 Subscripts and Index Vectors 33. 2 5 Matrices Lists and Data Frames 34,2 5 1 Matrices 34. 2 5 2 Lists 36,2 5 3 Data Frames 38,2 6 Attributes 39.
2 6 1 The Class Attribute and Factor Objects 40,2 6 2 Summary of Basic Object Types 42. 2 7 When to Quote Constants and Object Names 43,2 8 Function Libraries 44. 2 9 The Hmisc Library 45,2 10 Installing Add on Libraries 51. iv CONTENTS,2 11 Accessing Add On Libraries Automatically 52. 3 Data in S 53,3 1 Importing Data 53,3 2 Reading Data into S 53.
3 2 1 Reading Raw Data 53,3 2 2 Reading S Plus Data into R 54. 3 2 3 Reading SAS Datasets 55,3 2 4 Handling Date Variables in R 62. 3 3 Displaying Metadata 63,3 4 Adjustments to Variables after Input 64. 3 5 Writing Out Data 65,3 5 1 Writing ASCII files 65. 3 5 2 Transporting S Data 66,3 5 3 Customized Printing 66.
3 5 4 Sending Output to a File 67,3 6 Using the Hmisc Library to Inspect Data 67. 4 Operating in S 71, 4 1 Reading and Writing Data Frames and Variables 71. 4 1 1 The attach and detach Functions 72,4 1 2 Subsetting Data Frames 76. 4 1 3 Adding Variables to a Data Frame without Attaching 78. 4 1 4 Deleting Variables from a Data Frame 78, 4 1 5 A Better Approach to Changing Data Frames upData 78. 4 1 6 assign and store 80,4 2 Managing Project Data in R 81.
4 2 1 Accessing Remote Objects and Different Objects with the Same Names 82. 4 2 2 Documenting Data Frames 83,4 2 3 Accessing Data in Windows S Plus 84. 4 3 Miscellaneous Functions 85,4 3 1 Functions for Sorting 85. 4 3 2 By Processing 85, 4 3 3 Sending Multiple Variables to Functions Expecting only One 88. 4 3 4 Functions for Data Manipulation and Management 89. 4 3 5 Merging Data Frames 93, 4 3 6 Merging Baseline Data with One Number Summaries of Follow up Data 94. 4 3 7 Constructing More Complex Summaries of Follow up Data 94. 4 3 8 Subsetting a Data Frame by Examining Repeated Measurements 96. 4 3 9 Converting Between Matrices and Vectors Re shaping Serial Data 97. 4 3 10 Computing Changes in Serial Observations 101. 4 4 Recoding Variables and Creating Derived Variables 103. 4 4 1 The score binary Function 106,4 4 2 The recode Function 106.
4 4 3 Should Derived Variables be Stored Permanently 107. 4 5 Review of Data Frame Creation Annotation and Analysis 108. CONTENTS v, 4 6 Dealing with Many Data Frames Simultaneously 110. 4 7 Missing Value Imputation using Hmisc 112,4 8 Using S for Simulations and Bootstrapping 115. 5 Probability and Statistical Functions 123,5 1 Basic Functions for Statistical Summaries 123. 5 2 Functions for Probability Distributions 126, 5 3 Hmisc Functions for Power and Sample Size Calculations 129. 5 4 Statistical Tests 135,5 4 1 Nonparametric Tests 136.
5 4 2 Parametric Tests 138,6 Making Tables 141,6 1 S Plus supplied Functions 141. 6 2 The Hmisc summary formula Function 144,6 2 1 Implementing Other Interfaces 150. 6 3 Graphical Depiction of Two Way Contingency Tables 151. 7 Hmisc Generalized Least Squares Modeling Functions 153. 7 1 Automatically Transforming Predictor and Response Variables 153. 7 2 Robust Serial Data Models Time and Dose Response Profiles 163. 7 2 1 Example 165, 8 Builtin S Functions for Multiple Linear Regression 169. 8 1 Sequential and Partial Sums of Squares and F tests 172. 9 The Design Library of Modeling Functions 175,9 1 Statistical Formulas in S 175. 9 2 Purposes and Capabilities of Design 176, 9 2 1 Differences Between lm Builtin and Design s ols Function 181.
9 3 Examples of the Use of Design 181,9 3 1 Examples with Graphical Output 181. 9 3 2 Binary Logistic Modeling with the Prostate Data Frame 194. 9 3 3 Troubleshooting Problems with factor Predictors 197. 9 3 4 A Comprehensive Hypothetical Example 198, 9 3 5 Using Design and Interactive Graphics to Generate Flexible Functions 200. 9 4 Checklist of Problems to Avoid When Using Design 201. 9 5 Describing Representation of Subjects 202,10 Principles of Graph Construction 203. 10 1 Graphical Perception 203,10 2 General Suggestions 204. 10 3 Tufte on Chartjunk 205,10 4 Tufte s Views on Graphical Excellence 205.
10 5 Formatting 205,10 6 Color Symbols and Line Styles 206. vi CONTENTS,10 7 Scaling 206, 10 8 Displaying Estimates Stratified by Categories 206. 10 9 Displaying Distribution Characteristics 207,10 10Showing Differences 207. 10 11Choosing the Best Graph Type 208,10 11 1 Single Categorical Variable 208. 10 11 2 Single Continuous Numeric Variable 209, 10 11 3 Categorical Response Variable vs Categorical Ind Var 209.
10 11 4 Categorical Response vs a Continuous Ind Var 209. 10 11 5 Continuous Response Variable vs Categorical Ind Var 209. 10 11 6 Continuous Response vs Continuous Ind Var 209. 10 12Conditioning Variables 209,11 Graphics in S 213. 11 1 Overview 213, 11 2 Adding Text or Legends and Identifying Observations 220. 11 3 Hmisc and Design High Level Plotting Functions 223. 11 4 trellis Graphics 227, 11 4 1 Multiple Response Variables and Error Bars 234. 11 4 2 Multiple x axis Variables and Error Bars in Dot Plots 236. 11 4 3 Using summarize with trellis 236, 11 4 4 A Summary of Functions for Aggregating Data for Plotting 238. 12 Controlling Graphics Details 241,12 1 Graphics Parameters 241.
12 1 1 The Graphics Region 243,12 1 2 Controlling Text and Margins 244. 12 1 3 Controlling Plotting Symbols 247,12 1 4 Multiple Plots 251. 12 1 5 Skipping Over Plots 251,12 1 6 A More Flexible Layout 251. 12 1 7 Controlling Axes 253,12 1 8 Overlaying Figures 256. 12 2 Specifying a Graphical Output Device 260,12 2 1 Opening Graphics Windows 261.
12 2 2 The postscript ps slide setps setpdf Functions 261. 12 2 3 The win slide and gs slide Functions 263, 12 2 4 Inserting S Graphics into Microsoft Office Documents 263. 13 Managing Batch Analyses and Writing Your Own Functions 265. 13 1 Using S in Batch Mode 265,13 1 1 Batch Jobs in UNIX 265. 13 1 2 Batch Jobs in Windows 267,13 2 Managing S Non Interactive Programs 267. 13 3 Reproducible Analysis 279,13 4 Reproducible Reports 282. CONTENTS vii,13 5 Writing Your Own Functions 282,13 5 1 Some Programming Commands 282.
13 5 2 Creating a New Function 283,13 6 Customizing Your Environment 284. viii CONTENTS,List of Tables,1 1 Comparisons of SAS and S 12. 1 2 SAS Procedures and Corresponding S Functions 18. 2 1 Comparison of Some S Objects 42,4 1 Functions for Sorting 85. 4 2 Functions for Data Manipulation and Management 90. 5 1 Functions for Statistical Summaries 124,5 2 Probability Distribution Functions 127. 5 3 Hmisc Functions for Power Sample Size 129,5 4 S Functions for Statistical Tests 135.
6 1 Descriptive Statistics by Treatment 150,9 1 Operators in Formulae 176. 9 2 Special fitting functions 178, 9 3 Functions for transforming predictor variables in models 178. 9 4 Generic Functions and Methods 179,9 5 Generic Functions and Methods 180. 11 1 Non trellis High Level Plotting Functions 224. 12 1 Low Level Plotting Functions 242,x LIST OF TABLES. List of Figures, 5 1 Characteristics of control and intervention groups 134.
6 1 A two way contingency table 152,7 1 Transformations estimated by avas 157. 7 2 Distribution of residuals from avas fit 159,7 3 avas transformation vs reciprocal 159. 7 4 Predicted median glyhb as a function of age and chol 162. 7 5 Nonparametric estimates of time trends for individual subjects 166. 7 6 Bootstrap estimates of time trends 167, 7 7 Simultaneous and pointwise bootstrap confidence regions 168. 9 1 Cholesterol interacting with categorized age 182. 9 2 Restricted cubic spline surface in two variables each with k 4 knots 184. 9 3 Fit with age spline cholesterol and cholesterol spline age 185. 9 4 Spline fit with simple product interaction 186. 9 5 Predictions from linear interaction model with mean age in tertiles indicated 187. 9 6 Summary of model using odds ratios and inter quartile range odds ratios 188. 9 7 Cox PH model stratified on sex with interaction between age spline and sex 191. 9 8 Nomogram from fitted Cox model 192,9 9 Nomogram from fitted Cox model 193. 10 1 Error bars for individual means and differences 208. 11 1 Basic Plot 214,11 2 Basic Plot with Labels and Title 215.
11 3 Plotting a Factor 216,11 4 Example of Boxplot 216. 11 5 Example of Plot on a Fitted Model 218,11 6 Overriding datadist Values 219. 11 7 Example of Co Plot 220,11 8 Identifying Observations 222. 11 9 datadensity plot for the prostate data frame 225. 11 10Box percentile plot 227,xii LIST OF FIGURES, 11 11Extended box plot for titanic data Shown are the median mean solid dot and. quantile intervals containing 0 25 0 5 0 75 and 0 9 of the age distribution 231. 11 12Multi panel trellis graph produced by the Hmisc ecdf function 232. 12 1 Plot Region 244,12 2 Text in margins 248,12 3 Plotting Symbols 250.
12 4 Different Types of Lines 250,12 5 Flexible layout using mfg 252. 12 6 Controlling Axis Labels Style 254,12 7 Examples of tick marks 256. 12 8 Use of axis 258,12 9 Overlaying high level plots 259. 12 10Example of subplot 260,12 11Another subplot example 261. Introduction,1 1 S S Plus R and Source References, S Plus and R are supersets of the S language1 an interactive programming environment for data.
analysis and graphics Insightful Corporation in Seattle took the AT T Bell Labs S code and. enhanced it producing many new statistical functions and graphical interfaces In this text we use. S to refer to both S Plus and R languages, S is a unique combination of a powerful language and flexible high quality graphics functions. What is most important about S is that it was designed to be extendable Insightful AT T now. Lucent Technologies and a large community of S Plus users and R developers and users are con. stantly adding new capabilities to the system all using the same high level language S allows users. to take advantage of an explosion of powerful new data analysis and statistical modeling techniques. The richness of the S language and its planned extendability allow users to perform comprehensive. analyses and data explorations with a minimum of programming As an example S functions in the. Design library see Chapter 9 can perform analyses and make graphical representations that would. take pages of programming in other systems if they could be done at all. 1 S which may stand for statistics was developed by the same lab that developed the C language. 2 CHAPTER 1 INTRODUCTION, Fit binary logistic model without assuming linearity for age or. equal shapes of the age relationship for the two sexes. Represent age using a restricted cubic spline function with 4 knots. This requires 3 age parameters per sex Model has intercept 6. coefficients x T y T causes design matrix and response vector to. be stored in the fit object f This allows certain residuals to be. computed later and it allows the original data to be re analyzed. later e g bootstrapping and cross validation,f lrm death rcs age 4 sex x T y T. Test for age sex interaction 3 d f linearity in age 4 d f. overall age effect 6 d f overall sex effect 4 d f,linearity of age interaction with sex 2 d f. Compute the 60 40 year odds ratio for females,summary f age c 40 60 sex female.
Plot the age effects separately by sex with confidence bands. plot f age NA sex NA, Validate the model using the bootstrap check for overfitting. validate f, Draw a nomogram depicting the model adding an axis for the. predicted probability of death,nomogram f fun plogis funlabel Prob death. Get predicted log odds of death for 40 year old male. predict f data frame age 40 sex male, Make a new S Plus function which analytically computes predicted. values from the fitted model,g Function f, Use this function to duplicate the above prediction for 40 year old male.
g age 40 sex male, By making a high level language the cornerstone of S you could say that S is designed to be. inefficient for some applications from a pure CPU time point of view However computer time. is inexpensive in comparison with personnel time and analysts who have learned S can be very. much more productive in doing data analyses They can usually do more complex and exploratory. analyses in the same time that standard analyses take using other systems. In its most simple use S is an interactive calculator Commands are executed or debugged. as they are entered The S language is based on the use of functions to perform calculations open. graphics windows set system options and even for exiting the system Variables can refer to single. valued scalars vectors matrices or other forms Ordinarily a variable is stored as a vector e g. age will refer to all the ages of subjects in a dataset Perhaps the biggest challenge to learning S for. 1 1 S S PLUS R AND SOURCE REFERENCES 3, long time users of single observation oriented packages such as SAS is to think in terms of vectors. instead of a variable value for a single subject In SAS you might say. PROC MEANS VAR age Get mean and other statistics for age. DATA new SET old,IF age 16 THEN ageg Young ELSE ageg Old. The IF statement would be executed separately for each input observation In contrast to reference. a single value of age in S say for the 13th subject you would type age 13 To create the ageg. variable for all subjects you would use the S ifelse function which operates on vectors2. mean age Computed immediately not in a separate step. ageg ifelse age 16 Young Old,The assignment operator is typed as. To show how function calls can be intermixed with other operations look how easy it is to. compute the number of subjects having age the mean age. sum age mean age could have used table age mean age. or to get the proportion use mean age mean age, In S you can create and operate on very complex objects For example a flexible type of.
object called a list can contain any arbitrary collection of other objects This makes examination. of regression model fits quite easy as a fit object can contain a variety of objects of differing. shapes such as the vector of regression coefficients covariance matrix scalar R2 value number of. observations functions specifying how the predictors were transformed etc. S is object oriented Many of its objects have one or more classes and there are generic functions. that know what to do with objects of certain classes For example if you use S s linear model. function lm to create a fit object called f this object will have class lm Typing the commands. print f summary f or plot f will cause the print lm summary lm or plot lm functions. to be executed Typing methods lm or methods class lm will give useful information about. methods for creating or operating on lm objects, Basic sources for learning S are the manuals that come with the software Another basic source. for learning S and hence S Plus is a book called the New S language a k a the blue book. by Becker Chambers and Wilks 1988 One step above the previous one is Chambers and Hastie. 1992 Good introductions are Spector 1994 and Krause and Olson 2000 Other excellent. books are Venables and Ripley 1999 2000 Ripley has many useful S functions and other valuable. material available from his Web page http www stats ox ac uk ripley 3 A variety of. manuals come with S Plusand R from beginner s guides to more advanced programmer s manuals. Also see F E Harrell s book Regression Modeling Strategies which has long case studies using. S with commands and printed and graphical output and other references listed in the bibliography. Another source of help are the S news and R help mailing lists see biostat mc vanderbilt edu. Although not exclusively related to S and much of the material related to S packages is out of. date the statlib Web server lib stat cmu edu can provide specific software for some problems. 2 Note that a missing value for age in SAS would result in the person being categorized as Young In S the result. would be a missing value NA for such subjects, 3 Venables and Ripley s MASS S library has a wide variety of useful functions as well as many datasets useful for.

Related Books

Fitness for Work Guide -

Fitness for Work Guide maqohsc sa gov au

Fitness For Work Guide . Workers should ensure that their activities away from work do not impact on their ability to perform their duties safely. They should also inform themselves about the effects of alcohol and other drugs on their ability to work safely. A worker should present and remain, while at work, fit for work. Being impaired by ...

A Prayer for the Altar Guild - St. Anne's Church

A Prayer for the Altar Guild St Anne s Church

A Prayer for the Altar Guild O loving Savior, we pray thee to send thy blessing upon this Altar Guild and the work of all its members; give us thy grace that we may be loyal to the Holy Church, and faithful in our care of holy things. Grant that as we adorn and make ready thy altar, we may learn greater love and reverence for all that belongs to thy service, and through all outward symbols ...

hazelwoud klaar voor crius

hazelwoud klaar voor crius

Althea Proserpine brengt haar dochter groot met sprookjes. Ooit, lang, lang geleden was Althea een meisje dat Anna Parks heette, een van de vele dromers die halverwege de twintigste eeuw met een ko? er vol dromen naar Manhattan kwamen. Toen raakte ze vermist. Jaren later kwam ze terug en vergaarde een vreemd soort roem, met een glin- sterend randje maar ook iets duisters. Nu is ze opnieuw ...



Masyarakat di hulu maupun hilir secara tradisional dalam kehidupan sehari-hari mempunyai interaksi dengan kayu pertukangan. Kayu pertukangan dimanfaatkan sebagai bahan bangunan rumah maupun perabot rumah tangga. Masyarakat di wilayah hulu Provinsi Sumatera Selatan, terutama di Kabupaten Lahat, Empat Lawang dan Pagaralam pada masa lalu memperoleh kayu berkualitas (tenam, meranti dan merbau ...



With the name of Allah I devoted my soul, my wealth and my religion to You. Oh Allah Almighty, make me accept sincerely all of Your decision, grant me with Your bless in all my faith till I refused to ask You faster of what you have



ADVANCED MATRICULATION LEVEL 2019 SECOND SESSION SUBJECT: Home Economics and Human Ecology PAPER NUMBER: I DATE: 2nd September 2019 TIME: 9:00 a.m. to 12:05 p.m. ANSWER ANY FIVE QUESTIONS (20 marks each) 1. An elderly couple have decided to sell their semi-detached villa and buy a one-bedroom penthouse since their adult children have all moved out to live with their own families. The couple ...



COMPUTER SCIENCE (868) Aims (Conceptual) (1) (3)To understand algorithmic problem solving using data abstractions, functional and procedural abstractions, and object based and object-oriented abstractions. (2) To understand: (a) how computers represent, store and process data at different levels of abstraction that mediate between the machine and the algorithmic problem solving level and (b ...

The Book of Ascension to the Essential Truths of Sufism

The Book of Ascension to the Essential Truths of Sufism

of) Ascension to the Essential Truths of Sufism. All success is in God and He is the One Who guides to the right path. For each of these essential truths, I will mention what pertains to it in the beginning, middle and end of the way. 1. Sufism (al-ta?awwuf) Sufism (al-ta?awwuf) is the science of how to journey into the pres-

Applied Research Methods in Behavioral and Community Health

Applied Research Methods in Behavioral and Community Health

2 2 Catherine Dawson, Constable and Robinson Ltd:London, 2013. Behavior Theory in Health Promotion Practice and Research, Bruce Simons-Morton, Kenneth Riley McLeroy, Monica Wendel, Jones & Bartlett Publishers, 2011. Research Methods in Health Promotion, Richard A. Crosby (Editor), Ralph J. DiClemente (Editor), Laura F. Salazar (Editor), Jossey-Bass, 2006.

Government of Odisha

Government of Odisha

Suspension of VHSND and fixed Immunization Day in Sub-Center areas with COVID 19 Positive case ... Letter to Regional Director, RBI (20-Mar-2020)..... 62 C. Non-termination of employees from job or Reduction of their wages (21-Mar-2020)..... 62 15. Functioning of Courts (25-Mar-2020)..... 62 16. References..... 62. Government of Odisha Page 3 1. Revised Lockdown Order(19-Apr-2020, 18-Apr-2020 ...