Book Image

Statistical Analysis with R

By : John M. Quick
Book Image

Statistical Analysis with R

By: John M. Quick

Overview of this book

<p>R is a data analysis tool, graphical environment, and programming language. Without any prior experience in programming or statistical software, this book will help you quickly become a knowledgeable user of R. Now is the time to take control of your data and start producing superior statistical analysis with R.<br /><br />This book will take you on a journey as the strategist for an ancient Chinese kingdom. Along the way, you will learn how to use R to arrive at practical solutions and how to effectively communicate your results. Ultimately, the fate of the kingdom depends on your ability to make informed, data-driven decisions with R.<br /><br />You have unexpectedly been thrust into the role of lead strategist for the kingdom. After you install your predecessor's mysterious data analysis tool, you will begin to explore its fundamental elements. Next, you will use R to import and organize your data. Then, you will use functions and statistical analysis to arrive at potential courses of action. Subsequently, you will design your own functions to assess the practical impacts of your predictions. Lastly, you will focus on communicating your results through the use of charts, plots, graphs, and custom built visualizations. The fate of the kingdom is in your hands. Your rapid development as a master R strategist is the key to future success.</p>
Table of Contents (17 chapters)
Statistical Analysis with R Beginner's Guide
Credits
About the Author
About the Reviewers
Preface
Index

Preface

You have unexpectedly been thrust into the role of lead strategist for the kingdom. After you install your predecessor's mysterious data analysis tool, you will begin to explore its fundamental elements. Next, you will use R to import and organize your data. Then, you will use functions and statistical analyses to arrive at potential courses of action. Subsequently, you will design your own functions to assess the practical impacts of your predictions. Lastly, you will focus on communicating your results through the use of charts, plots, graphs, and custom built visualizations. The fate of the kingdom is in your hands. Your rapid development as a master R strategist is the key to future success.

What this book covers

Chapter 1, Uncovering the Strategist's Data Analysis Tool, serves as an introduction to the R Project. We will explore the benefits of using R and the topics covered in this book.

Chapter 2, Preparing R for Battle, includes a step-by-step guide to downloading and installing R. We will also launch R and execute our first commands.

Chapter 3, Exploring the Mysterious Data Analysis Tool, is an introduction to the R interface and programming language. In this chapter, we will use R to solve a complex puzzle.

Chapter 4, Collecting and Organizing Information, covers how to import data into R and manipulate it using variables. We will also learn how manage the R workspace.

Chapter 5, Assessing the Situation, focuses on evaluating our data and using it to generate predictive models. We will also consider the statistical and practical significance of our analyses.

Chapter 6, Planning the Attack, involves using our data models to predict potential outcomes and assess their logistical viability. Along the way, we will learn to build our own custom functions.

Chapter 7, Organizing the Battle Plans, revisits the task of planning and organizing a complete data analysis, such that it can be effectively communicated to others. Throughout this process, we will apply the common steps to all R analyses.

Chapter 8, Briefing the Emperor, is a first look at R's graphical capabilities. We will make customizable charts, graphs, and plots that can be exported for use outside of R.

Chapter 9, Briefing the Generals, examines the in-depth customization options available to several types of charts, graphs, and plots. We will also build our own custom graphics from scratch.

Chapter 10, Becoming a Master Strategist, describes the resources that are available to you beyond the contents of this book for further expanding your knowledge of R.

What you need for this book

This code used in this book should be applicable to any version of R on any platform, although it was generated and tested using R 2.11.1 for Mac OS X.

Who this book is for

You want to take control of your data and learn how to conduct effective analyses with R. Whether you are a data analyst, business or information technology professional, student, educator, researcher, or anyone else who wants to learn about R, this book is for you.

No prior experience with R is necessary. Knowledge of other programming languages, software packages, or statistics may be helpful, but is not required. With a willingness to learn and an interest in conducting superior data analyses, you will quickly become an experienced and knowledgeable R user.

Conventions

In this book, you will find several headings appearing frequently.

To give clear instructions of how to complete a procedure or task, we use:

Time for action – heading

  1. Action 1

  2. Action 2

  3. Action 3

Instructions often need some extra explanation so that they make sense, so they are followed with:

What just happened?

This heading explains the working of tasks or instructions that you have just completed.

You will also find some other learning aids in the book, including:

Pop quiz—heading

These are short multiple choice questions intended to help you test your own understanding.

Have a go hero—heading

These set practical challenges and give you ideas for experimenting with what you have learned.

You will also find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: "We also expanded upon the legend(...) function to gain more control over its appearance."

A block of code is set as follows:

> barplot(height = barAllMethodsDurationBars, 
main = barAllMethodsDurationLabelMain, 
xlab = barAllMethodsDurationLabelX, 
ylab = barAllMethodsDurationLabelY, 
xlim = barAllMethodsDurationLimX, 
ylim = barAllMethodsDurationLimY, 
col = barAllMethodsDurationRainbowColors)

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

> barplot(height = barAllMethodsDurationBars, 
main = barAllMethodsDurationLabelMain, 
xlab = barAllMethodsDurationLabelY, 
ylab = barAllMethodsDurationLabelX, 
xlim = barAllMethodsDurationLimY, 
ylim = barAllMethodsDurationLimX, 
col = barAllMethodsDurationRainbowColors)

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "The R Help window will open to display documentation on the provided function".

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or e-mail .

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Tip

Downloading the example code for this book

You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.