Plotting Normal Distributions

Description

Here, we will plot a normal distribution with mean 10 and standard deviation 2 from z-score -3.5 to z-score 3.5. To define our range of z-scores, we will use the sequence command to create a range of 200 points.

Sage Cell

Code

mean <- 10
sd <- 2
lower <- mean - 3.5 * sd
upper <- mean + 3.5 * sd
x <- seq(from=lower, to=upper, length.out=200)
plot(x=x, y=dnorm(x, mean=10, sd=2))

Options

Plotting a Curve

We can plot a normal curve instead of a distribution by adding "l" to the plot command.

Code

mean <- 10
sd <- 2
lower <- mean - 3.5 * sd
upper <- mean + 3.5 * sd
x <- seq(from=lower, to=upper, length.out=200)
plot(x=x, y=dnorm(x, mean=10, sd=2), "l")

Tags

Primary Tags:

Secondary Tags:

A list of possible tags can be found at The WeBWorK Open Problem Library. For linear algebra tags see the Curated Courses Project.

Related Cells

Any related cells go here. Provide a link to the page containing the information about the cell.

Attribute

Permalink:

Author:

Date: 18 Apr 2019 16:02

Submitted by: Zane Corbiere

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License