Step by step walkthrough covering the use of the following functions
rnorm()
pnorm()
rexp()
pexp()
pbinom()
dbinom()
ppois()
table()
tapply()
sd()
prop.table()
Examples are provided along with questions and answers.
link to sample data is provided in the presentation
Introduction to R –
Probabilities and tables
Link to the data used is provided
,Let’s start at the beginning
• Open RStudio; create a new script
• Clear R’s memory
• Set your working directory to the same folder you used for the oth
sessions
,Let’s start at the beginning
• Open RStudio; create a new script
• Clear R’s memory
rm(list=ls())
• Set your working directory to the same folder you used for the oth
sessions
setwd(“C:/Users/dtros/Documents/Using R/Session 1”)
,
,Probability Distributions
R has functions for a variety of probability distributions
,Function rnorm()
• To begin let’s find out what rnorm() is
• Bring up this functions help file
,
,Function rnorm()
• To begin let’s find out what rnorm() is
• Bring up this functions help file
• Were you able to do it? Remember that you can bring up a functio
help file using
?rnorm
• This is the last function in the list for ‘Normal Distribution’
• The description of rnorm() is as follows – rnorm() generates
random numbers that are from a normal distribution
• Run the following
x <- rnorm(100000, mean = 0, sd = 1)
,
, Function rnorm()
• Run the following
x <- rnorm(100000, mean = 0, sd = 1)
• As you can see, including spaces does not make a difference at this
point, as long as you have used the correct arguments and have
placed them in the correct order
• This line of code has produced 100 000 values from a standard
normal distribution; with a mean of 0 and a standard deviation of 1
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through EFT, credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying this summary from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller dominique13. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy this summary for R50,00. You're not tied to anything after your purchase.