Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

R Tutorial: Measuring Central Tendency of Test Scores, Study notes of Descriptive statistics

This r tutorial explains how to find measures of central tendency, such as mean, median, trimmed mean, and midrange, using r programming language and the given test scores dataset. It also covers estimated means from a frequency table and weighted means.

Typology: Study notes

2021/2022

Uploaded on 09/12/2022

captainamerica
captainamerica 🇺🇸

4.4

(13)

250 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Page R3.1
R TUTORIAL, #3:
MEASURES OF CENTER
The (>) symbol indicates something that you will type in.
A bullet (•) indicates what the R program should output (and other comments).
TEST SCORES DATA SET
> Type: scores <- c(80, 76, 100, 83, 100)
> Type: scores
• Check to make sure you entered the values in correctly.
MEAN
• Find the mean of the scores.
> Type: mean(scores)
• You can also find the mean as follows:
> Type: sum(scores) / length(scores)
TRIMMED MEANS
> Type: mean(scores, trim=.2)
• This takes the trimmed mean of the data set after the top 20% and the
bottom 20% have been deleted. Here, the ‘76’ and one of the ‘100’s are
deleted.
MEDIAN
• Find the median of the scores.
> Type: median(scores)
pf3

Partial preview of the text

Download R Tutorial: Measuring Central Tendency of Test Scores and more Study notes Descriptive statistics in PDF only on Docsity!

R TUTORIAL, #3:

MEASURES OF CENTER

The (>) symbol indicates something that you will type in. A bullet (•) indicates what the R program should output (and other comments).

TEST SCORES DATA SET

Type: scores <- c(80, 76, 100, 83, 100) Type: scores

  • Check to make sure you entered the values in correctly.

MEAN

  • Find the mean of the scores.

Type: mean(scores)

  • You can also find the mean as follows:

Type: sum(scores) / length(scores)

TRIMMED MEANS

Type: mean(scores, trim=.2)

  • This takes the trimmed mean of the data set after the top 20% and the bottom 20% have been deleted. Here, the ‘76’ and one of the ‘100’s are deleted.

MEDIAN

  • Find the median of the scores.

Type: median(scores)

MODE

  • Unfortunately, ‘mode’ doesn’t give us what we want.
  • The ‘table’ command gives frequencies, and it can help us find the mode:

Type: table(scores) - Look for the data value with the highest frequency.

Type: max(table(scores))

  • This indicates that the mode (100 points) has a frequency of 2.
  • The longer command below actually finds the mode.

Type: which(table(scores) == max(table(scores)))

  • The ‘4’ indicates that ‘100’ is the fourth-lowest unique data value, as shown in the table given by ‘table(scores)’.

MIDRANGE

  • Unfortunately, there is no ‘midrange’ command.
  • We will find the midrange step-by-step:

Type: min(scores) - You should see ‘76’.

Type: max(scores) - You should see ‘100’.

Type: (76+100)/ - You should see ‘88’, the midrange in points.

  • Here’s another way to find the midrange:

Type: range(scores) - You should see the min and the max of the data set. - WARNING: This is not really the “range” of the data set. We will use the term “range” to refer to a measure of spread.

Type: mean(range(scores)) - You should see ‘88’, the midrange in points.