Run these commands in R, then use your own words to describe what the resulting numbers represent. You can get some information about the functions by using the help commands in R (such as ?pbinom to get information about the pbinom() command in R):
a) pbinom(q=5, size=10, prob=1/6)
b)
n=10
p=.5
x=9
pbinom(x, n, p)
c) punif(5, min=1, max=10) - punif(4, min=1, max=10)
a)
The function pbinom returns the value of the cumulative density function (cdf) of the binomial distribution given a certain random variable q, number of trials (size) and probability of success on each trial (prob).
pbinom(q=5, size=10, prob=1/6) = "P(q\\le5)=P(q=0)+P(q=1)+P(q=2)+P(q=3)+P(q=4)+P(q=5)"
"P(q=0)=(5\/6)^{10}=0.1615"
"P(q=1)=10(1\/6)(5\/6)^{9}=0.323"
"P(q=2)=C^2_{10}(1\/6)^2(5\/6)^{8}=0.2907"
"P(q=3)=C^3_{10}(1\/6)^3(5\/6)^{7}=0.155"
"P(q=4)=C^4_{10}(1\/6)^4(5\/6)^{6}=0.0543"
"P(q=5)=C^5_{10}(1\/6)^5(5\/6)^{5}=0.013"
"P(q\\le5)=0.1615+0.323+0.2907+0.155+0.0543+0.013=0.9975"
b)
pbinom(x=9, size=10, prob=0.5) = "P(x\\le 9)=1-P(10)=1-0.5^{10}=0.999"
c)
command of Uniform Distribution, gives probability:
"P(4<x<5)" on the interval [1,10]
"P(4<x<5)=\\frac{5-4}{10-1}=1\/9"
Comments
Leave a comment