-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
83 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# polyplot2 | ||
## Tutorial for PolyPlot2 | ||
|
||
source("http://raw.githubusercontent.com/cwendorf/polyplot2/main/source-polyplot2.R") | ||
|
||
### The Basic PolyPlot | ||
|
||
#### In order to demonstrate the finer points of a PolyPlot, the following code simulates 1000 scores from a positively skewed unimodal distribution and then calls `polyplot2` using the default options. | ||
|
||
Scores <- c(rnorm(n=600,mean=100,sd=15),rnorm(n=200,mean=115,sd=20),rnorm(n=200,mean=130,sd=25)) | ||
polyplot2(Scores) | ||
|
||
### Using the PolyPlot to Determine Shape | ||
|
||
#### The following code demonstrates some of the available options for customizing the PolyPlot.Similarly, it demonstrates how the PolyPlot does a good job of approximating the shape of the underlying distribution. | ||
par(mfrow=c(1,2)) | ||
polyplot2(Scores,histogram=TRUE,curve=FALSE,values=FALSE,main="PolyPlot2 plus Histogram",col="darkblue",bg="darkgoldenrod") | ||
polyplot2(Scores,histogram=FALSE,curve=TRUE,values=FALSE,main="PolyPlot2 plus Density Curve",col="darkblue",bg="darkgoldenrod") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
--- | ||
title: "PolyPlot2" | ||
author: "Craig A. Wendorf" | ||
date: "`r Sys.Date()`" | ||
output: | ||
html_document: | ||
toc: true | ||
toc_float: true | ||
toc_depth: 4 | ||
collapse: true | ||
theme: cerulean | ||
highlight: tango | ||
keep_md: TRUE | ||
vignette: > | ||
%\VignetteIndexEntry{Tutorial for PolyPlot2} | ||
%\VignetteEngine{knitr::rmarkdown} | ||
%\VignetteEncoding{UTF-8} | ||
--- | ||
|
||
```{r,include=FALSE} | ||
#suppress the warnings and other messages from showing in the knitted file. | ||
knitr::opts_chunk$set(fig.width=7, fig.height=5,fig.path='figures/',echo=TRUE,warning=FALSE,message=FALSE) | ||
``` | ||
|
||
```{r,include=FALSE} | ||
library(polyplot2) | ||
``` | ||
|
||
## Tutorial for PolyPlot2 | ||
|
||
### The Basic PolyPlot | ||
|
||
In order to demonstrate the finer points of a PolyPlot, the following code simulates 1000 scores from a positively skewed unimodal distribution and then calls `polyplot2` using the default options. | ||
|
||
```{r} | ||
Scores <- c(rnorm(n=600,mean=100,sd=15),rnorm(n=200,mean=115,sd=20),rnorm(n=200,mean=130,sd=25)) | ||
polyplot2(Scores) | ||
``` | ||
|
||
By default, the function labels all of the points and provides summary statistics in the margin. Generally speaking, each level/row provides a different category of measures of location and spread. | ||
|
||
- First/Top: Provides the mode of the distribution, with the sample size listed in the right margin | ||
- Second: Provides the quartiles (and median) of the distribution, with the interquartile range divided by 2 in the right margin | ||
- Third: Provides the means of the halves (and the whole) of the distribution, with the mean absolute deviation from the median in the right margin | ||
- Fourth: Provides the mean of the distribution and points +/- one standard deviation from the mean, with the standard deviation in the right margin | ||
- Fifth/Bottom: Provides the range (and midrange) of the distribution, with the range divided by 2 in the right margin | ||
|
||
### Using the PolyPlot to Determine Shape | ||
|
||
The following code demonstrates some of the available options for customizing the PolyPlot.Similarly, it demonstrates how the PolyPlot does a good job of approximating the shape of the underlying distribution. | ||
|
||
```{r} | ||
par(mfrow=c(1,2)) | ||
polyplot2(Scores,histogram=TRUE,curve=FALSE,values=FALSE,main="PolyPlot2 plus Histogram",col="darkblue",bg="darkgoldenrod") | ||
polyplot2(Scores,histogram=FALSE,curve=TRUE,values=FALSE,main="PolyPlot2 plus Density Curve",col="darkblue",bg="darkgoldenrod") | ||
``` | ||
|
||
Further explanation of the polyplot and how it can be used to understand the shape of the distribution is available in Seier and Bonett (2011). |