Question
))using R program do the following )) 3 Normal distribution. Compute for X distributed as N (10, 2) the following probabilities and quantiles. (a) P(X
))using R program do the following ))
3 Normal distribution. Compute for X distributed as N (10, 2) the following probabilities and quantiles.
(a) P(X < 12).
(b) P(X > 8).
(c) P(9 < X < 10, 5).
(d) The quantiles x0.025, x0.5, and x0.975.
))script))
# 3.2.3 Chi-squared distribution ########################################
# Example 1. Load the TeachingDemos package to view... library(TeachingDemos) vis.gamma()
# Example 2. Let's consider the chi-squared variable with 5 degrees of freedom... pchisq(8, 5) # left-side tail of the Chi-squared cumulative density function (CDF)
dchisqFun<-function(x) { dchisq(x,5) } plot(dchisqFun, # function 0, # start 25, # end cex.lab=1.5, # make axis labels big xlab="x", ylab="Chi-Squared probability density function f(x)") x1 <- seq(0,8,0.1) x2 <- seq(8,25,0.1) polygon(c(0,x1,8), c(0,dchisqFun(x1),0), col="magenta") polygon(c(8,x2,25), c(0,dchisqFun(x2),0), col="lightblue") mtext("8",side=1,at=8) arrows(11,0.07,5,0.07, lwd=3, col="green") text(13, 0.075 - c(0,.018), cex = 1.2, adj=c(0,0), col="blue", c(expression(P(X <= 8)), expression(paste(" = ", integral(f(x) * dx, 0, 8)))))
pchisqFun<-function(x){pchisq(x,5)} plot(pchisqFun, # function 0, # start 20, # end cex.lab=1.5, # make axis labels big col="red", lwd=6, # make line thicker xlab="x", ylab="Chi-Squared cumulative distribution function F(x)") mtext("8", side=1,at=8, col="red") mtext("0.84",side=2,at=0.84, col="red") arrows(11,0.74,8,0.84, lwd=3, col="green") text(12, 0.67 - c(0,.11,.22,.33,.44), cex=1.2, adj=c(0,0), col="blue", c(expression(P(X <= 8)), expression(paste(" = ", integral(f(x) * dx, 0, 8))), expression(paste(" = ", bgroup("[", F(x) ,"]")[0]^8)), expression(paste(" = ", CDF(8))), expression(paste(" = ", 0.84))))
qchisq(0.025, 5, lower.tail=TRUE)
# Example 3. The chi-squared distribution is frequently used as a so-called goodness of fit measure... library(multtest); data(golub) golubFactor <- factor(golub.cl,levels=0:1, labels= c("ALL","AML")) ccnd3 = grep("CCND3",golub.gnames[ ,2], ignore.case = TRUE) ccnd3 x <- golub[ccnd3,golubFactor=="ALL"] z <- (x-1.90)/0.50 sum(z^2) pchisq(sum(z^2),26, lower.tail=FALSE)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started