- Introduction
- The
**χ²**Distribution: Graphs and Tables - pchisq() in R
- qchisq() in R
- Sample Problems
- Listing of all R commands used on this page

We use the letter

We have already seen the

We did see that the

There were two consequences of all of this. First, for the

Graph 1 |
Graph 2 |
Graph 3 |

Graph 4 |
Graph 5 |
Graph 6 |

The shape of the

We could set things up so that we have a cumulative probability table for each different number of degrees of freedom. Here is a link to a page that asks you for the number of degrees of freedom and then allows you to generate such a cumulative probability table. Try this for a several different degrees of freedom. The tables are quite different and quite long. It should not come as a shock to find that we do not want to have a table of cumulative probabilities for each different number of degrees of freedom. Rather, most statistics books give us a table of "convenient"

Figure 1 shows the top of that table.

We could use that table to say for

For

Graph 7P(x > 4) ≈ 0.04550026 |
Graph 8P(x > 4) ≈ 0.1353353 |
Graph 9P(x > 4) ≈ 0.4060058 |

Graph 10P(x > 4) ≈ 0.8571235 |
Graph 11P(x > 4) ≈ 0.9989033 |
Graph 12P(x > 4) ≈ 1 |

We do need to note here that although the area reported in

Returning, for a moment, to the table of values, we note that the choices for the convenient areas, the column headings, seem a little strange. Later when we are really using the

Before leaving the graphs and tables, we should at least combine the graphs 1 through 6 into one graph. This is the way that most books present the graphs of the

# look at areas to the right of 4 for 6 different # options on the degrees of freedom pchisq(4,1, lower.tail=FALSE) pchisq(4,2, lower.tail=FALSE) pchisq(4,4, lower.tail=FALSE) pchisq(4,8, lower.tail=FALSE) pchisq(4,16, lower.tail=FALSE) pchisq(4,32, lower.tail=FALSE)were used to find the areas reported above in graphs 7 through 12. The console view of those commands is shown in Figure 3.

The syntax of the

We need to specify a value, shown as

Then too, the one left tail value that we saw above was

`pchisq(1.239,7)`

The actual computed result while different from

Recall that the table value had been

`pchisq(1.239,7)`

`pchisq(1.239042,7)`

We did not hit the target

We should take note that by a simple change in the command to

`qchisq(0.01,7,lower.tail=FALSE)`

`pchisq(18.47531,7,lower.tail=FALSE)`

- For a
**χ²**distribution with 6 degrees of freedom, what is the probability of having a random event**X**be less than 2.34? - For a
**χ²**distribution with 9 degrees of freedom, what is the probability of having a random event**X**be greater than 15.34? - For a
**χ²**distribution with 17 degrees of freedom, what is the probability of having a random event**X**be less than 6.66 or greater than 27.34? - For a
**χ²**> distribution with 14 degrees of freedom, what is the probability of having a random event**X**be between 5.25 and 25.41? - For a
**χ²**distribution with 5 degrees of freedom, what is the**x-score**that has 0.0333 square units under the curve and to the**left**of that**x-score**? - For a
**χ²**distribution with 25 degrees of freedom, what is the**x-score**that has 0.125 square units under the curve and to the**right**of that**x-score**? - For a
**χ²**distribution with 11 degrees of freedom, what are the**x-scores**that hav 0.75 square units under the curve and between those**x-scores**with the tails having equal areas? - For a
**χ²**distribution with 23 degrees of freedom, what are the**x-scores**that have 0.0333 square units under the curve and to the outside the interval between those**x-scores**where the tails have equal areas?

1. The first problem becomes

2. The second problem becomes

3. The third problem becomes

4. The fourth problem becomes

5. The fifth problem becomes find a value for

6. The sixth problem becomes find a value for

7. The seventh problem becomes find a value for

8. The eighth problem becomes find values for

# Display the Chi-squared distributions with # 1, 2, 4, 8, 16, and 32 degrees of freedom. x <- seq(0, 40, length=200) hx <- rep(0,200) degf <- c(1,2,4,8,16,32) colors <- c("red", "orange", "green", "blue", "black", "violet") labels <- c("df=1", "df=2", "df=4", "df=8", "df=16", "df=32") plot(x, hx, type="n", lty=2, lwd=2, xlab="x value", ylab="Density", ylim=c(0,0.7), xlim=c(0,40), las=1, xaxp=c(0,40,10), main="Chi-Squared Distribution \n 1, 2, 4, 8, 16, 32 Degrees of Freedom" ) for (i in 1:6){ lines(x, dchisq(x,degf[i]), lwd=2, col=colors[i], lty=1) } abline(h=0) abline(h=seq(0.1,0.7,0.1), lty=3, col="darkgray") abline(v=0) abline(v=seq(2,40,2), lty=3, col="darkgray") legend("topright", inset=.05, title="Degrees of Freedom", labels, lwd=2, lty=1, col=colors) for (j in 1:6 ){ plot(x, hx, type="n", lty=2, lwd=2, xlab="x value", ylab="Density", ylim=c(0,0.7), xlim=c(0,40), las=1, xaxp=c(0,40,10), main=paste("Chi-Squared Distribution:",k[j]," Degrees of Freedom") ) for (i in j:j){ lines(x, dchisq(x,degf[i]), lwd=2, col=colors[i], lty=1) } abline(h=0) abline(h=seq(0.1,0.7,0.1), lty=3, col="darkgray") abline(v=0) abline(v=seq(2,40,2), lty=3, col="darkgray") legend("topright", inset=.05, title="Degrees of Freedom", labels[j], lwd=2, lty=1, col=colors[j]) } # look at areas to the right of 4 for 6 different # options on the degrees of freedom pchisq(4,1, lower.tail=FALSE) pchisq(4,2, lower.tail=FALSE) pchisq(4,4, lower.tail=FALSE) pchisq(4,8, lower.tail=FALSE) pchisq(4,16, lower.tail=FALSE) pchisq(4,32, lower.tail=FALSE) # look at a left tail pchisq(1.239,7) qchisq(0.01,7) pchisq(1.239042,7) qchisq(0.01,7,lower.tail=FALSE) pchisq(18.47531,7,lower.tail=FALSE) pchisq(2.34,6) pchisq(15.34, 9, lower.tail=FALSE) pchisq(6.66, 17) + pchisq(27.34, 17, lower.tail=FALSE) pchisq(25.41, 14) - pchisq(5.25, 14) qchisq(0.0333, 5) qchisq(0.125, 25, lower.tail=FALSE) qchisq( 0.125, 11) qchisq( 0.125, 11, lower.tail=FALSE ) qchisq( 0.01665, 23) qchisq( 0.01665, 23, lower.tail=FALSE )

©Roger M. Palay Saline, MI 48176 January, 2016