ebook img

Book for R Language Stats PDF

1426 Pages·2016·34.09 MB·English
by  
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Book for R Language Stats

DISCOVERING STATISTICS USING R DISCOVERING STATISTICS USING R ANDY FIELD | JEREMY MILES | ZOË FIELD © Andy Field, Jeremy Miles and Zoë Field 2012 First published 2012 Apart from any fair dealing for the purposes of research or private study, or criticism or review, as permitted under the Copyright, Designs and Patents Act, 1988, this publication may be reproduced, stored or transmitted in any form, or by any means, only with the prior permission in writing of the publishers, or in the case of reprographic reproduction, in accordance with the terms of licences issued by the Copyright Licensing Agency. Enquiries concerning reproduction outside those terms should be sent to the publishers. SAGE Publications Ltd 1 Oliver’s Yard 55 City Road London EC1Y 1SP SAGE Publications Inc. 2455 Teller Road Thousand Oaks, California 91320 SAGE Publications India Pvt Ltd B 1/I 1 Mohan Cooperative Industrial Area Mathura Road New Delhi 110 044 SAGE Publications Asia-Pacific Pte Ltd 3 Church Street #10-04 Samsung Hub Singapore 049483 Library of Congress Control Number: Available British Library Cataloguing in Publication data A catalogue record for this book is available from the British Library ISBN 978-1-4462-0045-2 ISBN 978-1-4462-0046-9 Typeset by C&M Digitals (P) Ltd, Chennai, India Printed and bound in Great Britain by Ashford Colour Press Ltd Printed on paper from sustainable resources CONTENTS Preface How to use this book Acknowledgements Dedication Symbols used in this book Some maths revision Why is my evil lecturer forcing me to learn 1 statistics? 1.1. What will this chapter tell me? 1.2. What the hell am I doing here? I don’t belong here 1.3. Initial observation: finding something that needs explaining 1.4. Generating theories and testing them 1.5. Data collection 1: what to measure 1.5.1. Variables 1.5.2. Measurement error 1.5.3. Validity and reliability 1.6. Data collection 2: how to measure 1.6.1. Correlational research methods 1.6.2. Experimental research methods 1.6.3. Randomization 1.7. Analysing data 1.7.1. Frequency distributions 1.7.2. The centre of a distribution 1.7.3. The dispersion in a distribution 1.7.4. Using a frequency distribution to go beyond the data 1.7.5. Fitting statistical models to the data What have I discovered about statistics? Key terms that I’ve discovered Smart Alex’s tasks Further reading Interesting real research Everything you ever wanted to know about 2 statistics(well, sort of) (well, sort of) 2.1. What will this chapter tell me? 2.2. Building statistical models 2.3. Populations and samples 2.4. Simple statistical models 2.4.1. The mean: a very simple statistical model Assessing the fit of the mean: sums of squares, variance and 2.4.2. standard deviations 2.4.3. Expressing the mean as a model 2.5. Going beyond the data 2.5.1. The standard error 2.5.2. Confidence intervals 2.6. Using statistical models to test research questions 2.6.1. Test statistics 2.6.2. One- and two-tailed tests 2.6.3. Type I and Type II errors 2.6.4. Effect sizes 2.6.5. Statistical power What have I discovered about statistics? Key terms that I’ve discovered Smart Alex’s tasks Further reading Interesting real research 3 The R environment 3.1. What will this chapter tell me? 3.2. Before you start 3.2.1. The R-chitecture 3.2.2. Pros and cons of R 3.2.3. Downloading and installing R 3.2.4. Versions of R 3.3. Getting started 3.3.1. The main windows in R 3.3.2. Menus in R 3.4. Using R 3.4.1. Commands, objects and functions 3.4.2. Using scripts 3.4.3. The R workspace 3.4.4. Setting a working directory 3.4.5. Installing packages 3.4.6. Getting help 3.5. Getting data into R 3.5.1. Creating variables 3.5.2. Creating dataframes 3.5.3. Calculating new variables from exisiting ones 3.5.4. Organizing your data 3.5.5. Missing values 3.6. Entering data with R Commander 3.6.1. Creating variables and entering data with R Commander 3.6.2. Creating coding variables with R Commander 3.7. Using other software to enter and edit data 3.7.1. Importing data 3.7.2. Importing SPSS data files directly 3.7.3. Importing data with R Commander 3.7.4. Things that can go wrong 3.8. Saving data 3.9. Manipulating data 3.9.1. Selecting parts of a dataframe 3.9.2. Selecting data with the subset() function 3.9.3. Dataframes and matrices 3.9.4. Reshaping data What have I discovered about statistics? R packages used in this chapter R functions used in this chapter Key terms that I’ve discovered Smart Alex’s tasks Further reading 4 Exploring data with graphs 4.1. What will this chapter tell me? 4.2. The art of presenting data 4.2.1. Why do we need graphs 4.2.2. What makes a good graph? 4.2.3. Lies, damned lies, and … erm … graphs 4.3. Packages used in this chapter 4.4. Introducing ggplot2 4.4.1. The anatomy of a plot 4.3.2. Geometric objects (geoms) 4.4.3. Aesthetics 4.4.4. The anatomy of the ggplot() function 4.4.5. Stats and geoms 4.4.6. Avoiding overplotting 4.4.7. Saving graphs 4.4.8. Putting it all together: a quick tutorial 4.5. Graphing relationships: the scatterplot 4.5.1. Simple scatterplot 4.5.2. Adding a funky line 4.5.3. Grouped scatterplot 4.6. Histograms: a good way to spot obvious problems 4.7. Boxplots (box–whisker diagrams) 4.8. Density plots 4.9. Graphing means 4.9.1. Bar charts and error bars 4.9.2. Line graphs 4.10. Themes and options What have I discovered about statistics? R packages used in this chapter R functions used in this chapter Key terms that I’ve discovered Smart Alex’s tasks Further reading Interesting real research 5 Exploring assumptions 5.1. What will this chapter tell me? 5.2. What are assumptions? 5.3. Assumptions of parametric data 5.4. Packages used in this chapter 5.5. The assumption of normality Oh no, it’s that pesky frequency distribution again: checking 5.5.1. normality visually 5.5.2. Quantifying normality with numbers 5.5.3. Exploring groups of data 5.6. Testing whether a distribution is normal 5.6.1. Doing the Shapiro–Wilk test in R 5.6.2. Reporting the Shapiro–Wilk test 5.7. Testing for homogeneity of variance 5.7.1. Levene’s test 5.7.2. Reporting Levene’s test 5.7.3. Hartley’s F : the variance ratio max 5.8. Correcting problems in the data 5.8.1. Dealing with outliers 5.8.2. Dealing with non-normality and unequal variances 5.8.3. Transforming the data using R 5.8.4. When it all goes horribly wrong What have I discovered about statistics? R packages used in this chapter R functions used in this chapter Key terms that I’ve discovered Smart Alex’s tasks Further reading 6 Correlation 6.1. What will this chapter tell me? 6.2. Looking at relationships

Description:
5.8.3. Transforming the data using R. 5.8.4. When it all goes horribly wrong. What have I discovered about statistics? R packages used in this chapter.
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.