# USING R FOR STATISTICS PDF

Preface. These notes are an introduction to using the statistical software package R for an introductory statistics course. They are meant to accompany an. SUR: Introduction to Probability and Statistics Using R Basic R Operations and Concepts. .. A graph of a bivariate normal PDF. If you are in need of a local copy, a pdf version is continuously · maintained. R code will be typeset using a monospace font which is syntax highlighted. a = 3.

Author: | LEIA SCHOEDER |

Language: | English, Spanish, Arabic |

Country: | India |

Genre: | Fiction & Literature |

Pages: | 749 |

Published (Last): | 28.02.2015 |

ISBN: | 445-1-61082-586-3 |

ePub File Size: | 26.53 MB |

PDF File Size: | 10.77 MB |

Distribution: | Free* [*Regsitration Required] |

Downloads: | 22225 |

Uploaded by: | ROXIE |

Using R for the study of topics of statistical methodology, such as International Standard Book Number (eBook - PDF). Using R for Introductory Statistics. John Verzani. CHAPMAN & HALL/CRC. A CRC Press Company. Boca Raton London New York Washington, D.C. Basic statistics using R Before using any functions in the packages, you need to load the packages Menu: File -> Save As -> JPEG / BMP / PDF / postscript.

Help and Guidance R is case sensitive and does not give overly useful diagnostic messages. When in doubt, use the help function. This is identical to the? All packages and all functions will have an associated help window.

Each help window will give a brief description of the function, how to call it, the definition of all of the available parameters, a list and definition of the possible output, and usually some useful examples.

One can learn a great deal by using the help windows, but if they are available, it is better to study the package vignette. Package vignettes All packages have help pages for each function in the package. These are meant to help you use a function that you already know about, but not to introduce you to new functions.

An increasing number of packages have a package vignettes that give more of an overview of the program than a detailed description of any one function. These vignettes are accessible from the help window and sometimes as part of the help index for the program. The two vignettes for the psych package are also available from the personality project web page. An overview of the psych package and Using the psych package as a front end to the sem package.

Commands are entered into the "R Console" window. You can add a comment to any line by using a. The Mac version has a text editor window that allows you to write, edit and save your commands. Alternatively, if you use a normal text editor As a Mac user, I use BBEDIT, PC users can use Notepad , you can write out the commands you want to run, comment them so that you can remember what they do the next time you run a similar analysis, and then copy and paste into the R console.

Although being syntax driven seems a throwback to an old, pre Graphical User Interface type command structure, it is very powerful for doing production statistics. Once you get a particular set of commands to work on one data file, you can change the name of the data file and run the entire sequence again on the new data set.

This is is also very helpful when doing professional graphics for papers. In addition, for teaching, it is possible to prepare a web page of instructional commands that students can then cut and paste into R to see for themselves how things work.

That is what may be done with the instructions on this page. It is also possible to write text in latex with embedded R commands. Then executing the Sweave function on that text file will add the R output to the latex file. This almost magical feature allows rapid integration of content with statistical techniques. More importantly, it allows for "reproducible research" in that the actual data files and instructions may be specified for all to see.

As you become more adept in using R, you will be tempted to enter commands directly into the console window. I think it is better to keep annotated copies of your commands to help you next time. Not necessary, but useful.

## R for Statistics.pdf

Help and Guidance For a list of all the commands that use a particular word, use the apropos command: apropos table lists all the commands that have the word "table" in them apropos table [1]"ftable" "model. A very nice example is demo graphics which shows many of the complex graphics that are possible to do. Entering or getting the data There are multiple ways of reading data into R. From a text file For very small data sets, the data can be directly entered into R.

For more typical data sets, it useful to use a simple text editor or a spreadsheet program e. You can enter data in a tab delimted form with one variable per column and columns labeled with unique name. A numeric missing value code say is more convenient than using ". To read the data into a rows subjects by columns variables matrix use the read. A very useful command, for those using a GUI is file. In this case, you can specify that the seperators are commas. From the web For teaching, it is important to note that it is possible to have the file be a remote file read through the web.

Note that for some commands, there is an important difference between line feeds and carriage returns. For those who use Macs as web servers, make sure that the unix line feed is used rather than old Mac format carriage returns.

For simplicity in my examples I have separated the name of the file to be read from the read. These two commands can be combined into one.

The file can be local on your hard disk or remote. For most data analysis, rather than manually enter the data into R , it is probably more convenient to use a spreadsheet e. Most of the examples in this tutorial assume that the data have been entered this way. Many of the examples in the help menus have small data sets entered using the c command or created on the fly. The file is structured normally, i. To read from a local file, we simply change the name of the datafilename.

Tables allow one to have columns that are either numeric or alphanumeric. To address a particular row e. In order to select a particular subset of the data, use the subset function. The next example uses subset to display cases where the lie scale was pretty high subset person. Use the package manager option package. Unfortunately, although read.

I will check this. If files are saved on remote servers, use the load url remoteURLname command. Commands are entered in the command console and at least for Macs , are colored red while results in the results console are shown in blue.

Commands can be cut and pasted from a text editor or from a browser if following along with examples into the command console.

Like Unix or OS X, using the up arrow shows previous commands. It is a useful habit to be consistent in your own naming conventions. Some use lower case letters for variables, Capitalized for data frames, all caps for functions, etc. It is easier to edit your code if you are reasonably consistent. Comment your code as well. This is not just so others can use it, but so that you can remember what you did 6 months later.

The with construct is better. The with construct is more appropriate when doing some specific analysis.

Similar to the most basic spreadsheet. Very dangerous! Two of the most useful are the ability to replace if a certain condition holds, and to find subsets of the data. The R workspace 3. Setting a working directory 3. Installing packages 3. Getting help Getting data into R 3. Creating variables 3. Creating dataframes 3. Calculating new variables from exisiting ones 3.

Organizing your data 3. Missing values Entering data with R Commander 3. Creating variables and entering data with R Commander 3. Creating coding variables with R Commander Using other software to enter and edit data 3.

## Related titles

Importing data 3. Importing SPSS data files directly 3. Importing data with R Commander 3. Things that can go wrong Saving data Manipulating data 3. Selecting parts of a dataframe 3.

Selecting data with the subset function - 7 - 3. Dataframes and matrices 3. Reshaping data What have I discovered about statistics? The art of presenting data 4.

Why do we need graphs 4. What makes a good graph? Lies, damned lies, and … erm … graphs Packages used in this chapter Introducing ggplot2 4.

The anatomy of a plot 4. Geometric objects geoms 4. Aesthetics 4.

## Discovering Statistics Using R.pdf - DISCOVERING STATISTICS...

The anatomy of the ggplot function 4. Stats and geoms 4. Avoiding overplotting 4. Saving graphs 4.

Putting it all together: a quick tutorial Graphing relationships: the scatterplot 4. Simple scatterplot 4. Adding a funky line 4. Grouped scatterplot Histograms: a good way to spot obvious problems Boxplots box—whisker diagrams Density plots Graphing means 4.

Bar charts and error bars - 8 - 4. Line graphs 4. Themes and options What have I discovered about statistics? What are assumptions?

Quantifying normality with numbers 5. Exploring groups of data Testing whether a distribution is normal 5. Doing the Shapiro—Wilk test in R 5. Reporting the Shapiro—Wilk test Testing for homogeneity of variance 5. Dealing with outliers 5. Dealing with non-normality and unequal variances 5. Transforming the data using R 5.

When it all goes horribly wrong What have I discovered about statistics? Looking at relationships How do we measure relationships? A detour into the murky world of covariance 6.

Standardization and the correlation coefficient 6. The significance of the correlation coefficient 6. Confidence intervals for r 6.

A word of warning about interpretation: causality Data entry for correlation analysis Bivariate correlation 6. Packages for correlation analysis in R 6. General procedure for correlations using R Commander 6. General procedure for correlations using R 6.

Bootstrapping correlations 6. Biserial and point-biserial correlations Partial correlation 6. The theory behind part and partial correlation 6. Partial correlation using R 6. Comparing independent rs 6. Comparing dependent rs Calculating the effect size How to report correlation coefficents What have I discovered about statistics? An introduction to regression 7. Some important information about straight lines 7.

The method of least squares 7. Assessing the goodness of fit: sums of squares, R and R2 7. Assessing individual predictors Packages used in this chapter General procedure for regression in R 7.

Doing simple regression using R Commander 7. Regression in R Interpreting a simple regression 7. Overall fit of the object model 7. Model parameters 7. Using the model Multiple regression: the basics 7. An example of a multiple regression model 7. Sums of squares, R and R2 7.

Parsimony-adjusted measures of fit 7.

Methods of regression How accurate is my regression model? Assessing the regression model I: diagnostics 7. Some things to think about before the analysis 7. Multiple regression: running the basic model 7.

Interpreting the basic multiple regression 7. Comparing models 7. Diagnostic tests using R Commander 7. Outliers and influential cases 7. Assessing the assumption of independence 7.

Assessing the assumption of no multicollinearity 7. Checking assumptions about the residuals 7. What if I violate an assumption? Robust regression: bootstrapping 7. How to report multiple regression 7. Categorical predictors and multiple regression 7. Dummy coding 7. Regression with dummy variables What have I discovered about statistics? Background to logistic regression What are the principles behind logistic regression?

Assessing the model: the log-likelihood statistic 8. Assessing the model: the deviance statistic 8. Assessing the model: R and R2 8. Assessing the model: information criteria 8. Assessing the contribution of predictors: the z-statistic 8. The odds ratio 8. Methods of logistic regression Assumptions and things that can go wrong 8.

Assumptions 8. Preparing the data 8. The main logistic regression analysis 8. Basic logistic regression analysis using R 8. Interpreting a basic logistic regression 8. Model 1: Intervention only 8. Model 2: Intervention and Duration as predictors 8. Casewise diagnostics in logistic regression 8. Calculating the effect size How to report logistic regression Testing assumptions: another example 8.

Testing for multicollinearity 8. Testing for linearity of the logit Predicting several categories: multinomial logistic regression 8. Running multinomial logistic regression in R 8. Interpreting the multinomial logistic regression output 8. Reporting the results What have I discovered about statistics? Packages used in this chapter Looking at differences - 13 - 9.

A problem with error bar graphs of repeated-measures designs Step 1: calculate the mean for each participant Step 2: calculate the grand mean Step 3: calculate the adjustment factor 9.

Step 4: create adjusted values for each variable The t-test 9. Rationale for the t-test 9. The t-test as a general linear model 9.Once they are installed.. Import the ozone table. Testing for linearity of the logit Predicting several categories: Choose the qualitative variable Groups pick one , the quantitative vari- able Response variable pick one and the alternative test hypothesis by default, the alternative hypothesis is that the means are different and the test is Two-sided.

Stats and geoms 4.

**Other books:**

*CURRICULUM VITAE SAMPLES PDF FORMAT*

### Related Posts:

- GATE 2015 APPLICATION FORM PDF
- CONSTRUCTION DRAWINGS AND DETAILS FOR INTERIORS PDF
- MATHEMATICS FORMULA BOOK PDF
- AADHAR CARD FORM 2013 PDF
- MICROSOFT FOREFRONT TMG 2010 EBOOK
- PHOTOSHOP USER MAGAZINE PDF
- THE FAULT IN OUR STARS PDF FOR IPHONE
- HEROES OF OLYMPUS HOUSE OF HADES PDF
- ADM940 SAP AUTHORIZATION CONCEPT.PDF
- DEATH OF WCW PDF