__Example:__Let’s begin with our sample data set:

To begin our analysis, we must select, from the topmost menu,

**“Analyze”**, then “

**Descriptive Statistics”**, followed by

**“Q-Q Plot”**.

This should cause the following menu to appear:

**“Y”**as a variable. Once this has been completed, click

**“OK”**. This should cause the following output to be generate.

**“Q-Q Plot”**, plots the quartiles of a normal distribution against sample data, the

**“P-P Plot”**, plots the cumulative probability distribution of the sample data against a cumulative normal probability distribution.

In almost all cases, to avoid confusion, you should preferably utilize the Q-Q Plot.

To generate the same output within R, we would utilize the following code:

__Example (R):__**# With the package ‘qqplotr’ downloaded and enabled #**

# Create vector #

y <- c(70, 80, 73, 77, 60, 93, 85, 72, 90, 85)

# Transform vector into data frame #

y <- data.frame(norm = y)

# Create graphical output #

gg <- ggplot(data = y, mapping = aes(sample = norm)) +

stat_pp_band() +

stat_pp_line() +

stat_pp_point() +

labs(x = "Probability Points", y = "Cumulative Probability")

gg

# Create vector #

y <- c(70, 80, 73, 77, 60, 93, 85, 72, 90, 85)

# Transform vector into data frame #

y <- data.frame(norm = y)

# Create graphical output #

gg <- ggplot(data = y, mapping = aes(sample = norm)) +

stat_pp_band() +

stat_pp_line() +

stat_pp_point() +

labs(x = "Probability Points", y = "Cumulative Probability")

gg

**This should produce the following visual output:**

That’s all for now. See you soon for more interesting content, Data Heads!

## No comments:

## Post a Comment

Note: Only a member of this blog may post a comment.