R studio help for statatistics and probability: Can anyone please help me with t
ID: 3061529 • Letter: R
Question
R studio help for statatistics and probability:
Can anyone please help me with the steps? thank you.
For each question, using R studio: Distributions a. Binomial(n=10, p = 0.4) b. Geometric(p = 0.4) steps: 1. Plot the Probability Function (PMF or PDF and CDF in different panels, 2. Calculate mean, standard deviation, and variance for each distribution and summarize them in a table (Table 1). 3. Calculate 25th 50, and 75th percentiles and summarize them in a table (Table 2). 4. Just for the Binomial distribution: .Calculate the CDF for all possible values of X, Approximate CDF for all possible values of X using a Normal distribution and compare them with the exact values that you have calculated (Table 3)Explanation / Answer
par(mfrow=c(3,2))
r=rbinom(1000,10,0.4)
u=sort(unique(r))
p=pbinom(u,10,0.4)
norm=sqrt(10)*((u/10)-0.4)/(sqrt(0.4*0.6))
p_norm=pnorm(norm)
cb=cbind(p,p_norm)
plot(dbinom(u,10,0.4),main="PMF plot")
plot(p,main="CDF plot")
matplot(cb,col=c("red","green"),type="l")
legend(y=0.8,x=8,col=c("red","green"),lwd=2,c("Original CDF","Normal CDF"))
mean=sum(u*dbinom(u,10,0.4))
var=sum((u^2)*dbinom(u,10,0.4))-mean^2
std=sqrt)var
q_25=min(u[p>=0.25])
q_50=min(u[p>=0.5])
q_75=min(u[p>=0.75])
for geometric,the code is dgeom and pgeom
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.