Presentation is loading. Please wait.

Presentation is loading. Please wait.

Descriptive Statistics using R. Summary Commands An essential starting point with any set of data is to get an overview of what you are dealing with You.

Similar presentations


Presentation on theme: "Descriptive Statistics using R. Summary Commands An essential starting point with any set of data is to get an overview of what you are dealing with You."— Presentation transcript:

1 Descriptive Statistics using R

2 Summary Commands An essential starting point with any set of data is to get an overview of what you are dealing with You might start by using the ls() command in R to see what named objects you have with you You can type the name of one of the objects to view its contents. You may use the str() command, which shows you the structure of the data. The summary() command is designed to give a quick statistical summary of data objects.

3 Summarizing Samples In case of repeated measurements (or sample), you usually want to summarize the data by showing measures like average. In R, you have a variety of commands that operate on samples; these samples of data might be individual vectors, or they may be columns in a data frame or part of a matrix or list.

4 Summary Commands with Single Value max min length sum mean median sd var mad

5 Summary Commands producing Multiple values summary quantile Example: > quantile(x, probs = seq(0, 1, 0.25), na.rm = FALSE, names = TRUE)

6 Descriptive Statistics using R - Commands str names levels head mean var / sd summary fivenum boxplot hist table mosaicplot

7 Descriptive Statistics using R – Assignment Install the package “MASS” Investigate the dataset ‘survey’ What is the data structure of survey? How many variables does it include? How many observations are there? How many numerical variables are there? Which variable contains whole numbers? How many categorical variables are there? What are the values of variables Smoke and Exer? Investigate the variable Height. Draw a histogram. What is your observation?

8 Descriptive Statistics using R – Assignment ….contd Find the quartiles, mean, median, max and min of the observations for the variable Height Draw a Box-plot of Height and examine Compare the heights of Males and Females Prepare a Contingency table of Sex and Smoke. How many Male students are Heavy smokers? How many Female students do not smoke? Draw a Mosaic plot for the above table Find the variance of Height. How will you calculate it properly after taking care of invalid values?


Download ppt "Descriptive Statistics using R. Summary Commands An essential starting point with any set of data is to get an overview of what you are dealing with You."

Similar presentations


Ads by Google