Tuesday, January 1, 2013

Normal Distribution using simple R command

The main objective of this study is to learn to plot the cumulative distribution function, quantiles and probability mass function using simple R commands.
R Commands:
·         seq – is used to generate a sequence of values.
·         pnorm – is used to calculate the cumulative distribution function.
·         dnorm – is used to calculate the probability mass function
·         qnorm- is used to generate quantiles or inverse of the normal distribution.
R commands and images:

Using Pnorm:

·         x<- seq(-5,5, length = 250)
·         plot(x,pnorm(x), type ="l", lwd = 2, col ="blue", xlab =" x values", ylab = "CDF")

Using dnorm:
·         x<- seq(-5,5, length = 250)
·         plot(x,dnorm(x), type ="l", lwd = 2, col ="blue", xlab =" x values", ylab = "PDF")

The primary goal is to understand the commands in R that help in creating basic statistical images. Readers can use Wikipedia in order to learn more about normal distribution and its usefulness in statistics and economics.

No comments:

Post a Comment