0% found this document useful (0 votes)
21 views

Assignment Unit 6

The document provides examples of using various probability functions in R including dbinom(), pbinom(), qexp(), pexp(), qnorm(), and pnorm(). It asks the user to run commands calculating probabilities related to binomial, exponential, and normal distributions. Examples include finding the probability of getting a certain number of heads when flipping a coin, the probability of a time interval being below a certain value, cutoff points for distributions, and more. The document tests the user's understanding of key probability and statistical concepts.

Uploaded by

Srabon Hasan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Assignment Unit 6

The document provides examples of using various probability functions in R including dbinom(), pbinom(), qexp(), pexp(), qnorm(), and pnorm(). It asks the user to run commands calculating probabilities related to binomial, exponential, and normal distributions. Examples include finding the probability of getting a certain number of heads when flipping a coin, the probability of a time interval being below a certain value, cutoff points for distributions, and more. The document tests the user's understanding of key probability and statistical concepts.

Uploaded by

Srabon Hasan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Assignment Unit 6

1) The first task is to review some information that might be useful later:
a) Write a brief definition of the word “quartile” as we have used it in previous weeks. Be sure to
provide
a citation: _____________________________.
Quartile is a number that separate the data into four equal parts or into quarters. (Yakir, 2011, P 32)

b) Write a brief definition of the word “quantile” as it might be used in statistics. Be sure to provide a
citation (do not cut and paste… use your own words to summarize what you discovered):
________________________________.
A Quantile is each set of values of a variate which divides probability distribution into continuous
intervals with equal probabilities In R a quantile is a function which produces quantiles corresponding
to
given probabilities. (Fan, n.d.)

c) From within interactive R, enter the command shown below (the command shows a help page for the
pbinom command). Provide a very brief description of the arguments that are passed to the pbinom()
command (“arguments” in computer programming are the options that you give to a function so that
the
function can calculate what you want it to). Note that one of the arguments is lower.tail = TRUE, and
because there is a value assigned to it with the equals sign, it means that if you do not enter a new value
for lower.tail, it will be set to TRUE by default. Do not type the “>” into R, it is the command prompt:
>?
pbinom
The first argument is an interval from the sample space of a binomial distribution, the second argument
is the sample size in a binomial distribution, the third argument is the probability of success in a
binomial
distribution, lower.tail = True is a logical value to tell the function to calculate the cumulative
probabilities of the lower tail that is probabilities that are less than or equal to the given x value; if the
value is False cumulative probabilities for values greater or equal to the given x value are calculated,
log.p =True/False is a logical value if True probabilities p are given as log(p) or otherwise as usual
decimals if false

2) You can use the dbinom() command (function) in R to determine the probability of getting 0 heads
when you flip a fair coin four times (the probability of getting heads is 0.5):
Dbinom(0, size=4, prob=0.5)
Find the equivalent values for getting 1, 2, 3, or 4 heads when you ip the coin four times. TIP: after you
run the rst dbinom() command, press the up arrow and make a small change and run it again.
Probability of getting exactly 1 head: _______0.2500
Probability of getting exactly 2 heads: _______0.3750
Probability of getting exactly 3 heads: _______0.2500
Probability of getting exactly 4 heads: _______0.0625
> dbinom(0, size=4, prob=0.5)
[1] 0.0625
> dbinom(1:4,size=4, prob=0.5)
[1] 0.2500 0.3750 0.2500 0.0625

3) Use the pbinom() function in R to show the cumulative probability of getting 0, 1, 2, 3, or 4 heads
when you ip the coin 4 times (this is the same as finding the probability than the value is less than or
equal to 0, 1, 2, 3, or 4.)
Probability of getting no more than 0 heads: ____0.0625
Probability of getting no more than 1 head: _____0.3125
Probability of getting no more than 2 heads:_____ 0.6875
Probability of getting no more than 3 heads: ____0.9375
Probability of getting no more than 4 heads: ____1.0000
> pbinom(0:4,4,0.5)
[1] 0.0625 0.3125 0.6875 0.9375 1.0000

4) The following R command will show the probability of exactly 6 successes in an experiment that has
10 trials in which the probability of success for each trial is 0.5: dbinom(6, size=10, prob=0.5)
(True/False)____________True
> dbinom(6, size=10, prob=0.5)
[1] 0.2050781

5) Read Yakir (2011, pp. 68-69) carefully to review the meaning of the pbinom function (related to tests
that a value will be “equal to” versus “less than or equal to” a criterion value). What is the probability
of
getting fewer than 2 heads when you flip a fair coin 3 times (round to 2 decimal places) ? ______0.5
> pbinom(1,3,0.5)
[1] 0.5

6) What is the probability of getting no more than 3 heads when you flip a fair coin 5 times (be sure to
understand the wording differences between this question and the previous one—round to 2 decimal
places)? ________0.8125
> pbinom(3,5,0.5)
[1] 0.8125

7) What is the expectation for the time interval between customers entering the store? Be sure to
specify the units of measurement in your answer (see Yakir, 2011, pp. 79-80). Round to 3 decimal
places:
___________________ 15 customers per second
Expectation = 1/rate=1/(1/15)=15
8) What is the variance of the time interval? Be sure to specify the units of measurement in your
answer. Round to 3 decimal places:_________________225 seconds
Var(X) = 1/λ^2=1/(1/15*1/15)=225

9) The pexp() function is introduced at the bottom of Yakir, 2011, p. 79, and there are some tips above.
What is the probability that the time interval between customers entering the store will be less than
15.5 seconds. Be sure to enter values so that everything is in the same unit of measurement. Be sure to
specify the units of measurement in your answer. Round your answer to 3 decimal places:
_________________. 0.644 (seconds)
Pexp(15.5,1/15)
[1] 0.6441811

10) What is the probability that the time interval between customers entering the store will be between
10.7 seconds and 40.2 seconds (see Yakir (2011, p. 79-80)?________ 0.421445
> pexp(40.2,1/15)-pexp(10.7,1/15)
[1] 0.421445

11) The qexp() function in R allows you to enter a probability, and it will tell you the criterion value
(“cuto
point”) that corresponds to that probability value (e.g., if you enter .05 it tells you the cutoff point
below
which 5% of the values in the distribution fall).
What value of x would be the criterion value (cut-off point) for the top 5% of time intervals (Round to
3
decimal places, and include the units of measurement)? _______44.936 seconds
> qexp(0.95,1/15)
[1] 44.93598

12) Describe in your own words the meaning of the number that the following R command produces
(you are asked to interpret the resulting number so that we understand what that number means)
………… 0.9726763 is the cumulative probability of values less or equal to 1.2.
Pexp(1.2, rate=3)
> pexp(1.2, rate=3)
[1] 0.9726763

13) What is the probability that a randomly selected value from variable A will be greater than 9 (see
Yakir, 2011 p. 88-89, 100)?_______ 0.2524925

> 1-pnorm(9,7,3)
[1] 0.2524925

14) What value of variable A would be the cutoff point (criterion value) for identifying the lowest 4%
of
values in variable A (use the qnorm function)?____________ 1.747942
> qnorm(0.04,7,3)
[1] 1.747942

15) What is the probability that a randomly selected value from variable A will be more than one
standard deviation above its mean (there are couple ways to solve this, one way is to use the standard
normal distribution, Yakir, 2011, p. 90-91) ? ________________0.1586553
> 1-pnorm(1)
[1] 0.1586553

References:

Fan, Y. A. H. R. J. (n.d.). Rob J Hyndman - Sample quantiles in statistical packages.


https://robjhyndman.com/publications/quantiles/

Yakir. B (2011). Introduction to Statistical Thinking (With R, Without Calculus), Retrieved from
https://my.uopeople.edu/pluginfile.php/57436/mod_book/chapter/37629/MATH1280.IntroStat.pdf

You might also like