# Chi-squared Random Samples

Example Data | 244 | 238 | 1 |

Help | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|

## The (non-central) $\chi^2$ Distribution## DescriptionDensity, distribution function, quantile function and random
generation for the chi-squared ( ## Usagedchisq(x, df, ncp = 0, log = FALSE) pchisq(q, df, ncp = 0, lower.tail = TRUE, log.p = FALSE) qchisq(p, df, ncp = 0, lower.tail = TRUE, log.p = FALSE) rchisq(n, df, ncp = 0) ## Arguments
## DetailsThe chi-squared distribution with
for The non-central chi-squared distribution with
for Note that the degrees of freedom Note that ## Value
Invalid arguments will result in return value The length of the result is determined by The numerical arguments other than ## NoteSupplying The code for non-zero ## SourceThe central cases are computed via the gamma distribution. The non-central The non-central Ding, C. G. (1992)
Algorithm AS275: Computing the non-central chi-squared
distribution function. which computes the lower tail only (so the upper tail suffers from cancellation and a warning will be given when this is likely to be significant). The non-central ## ReferencesBecker, R. A., Chambers, J. M. and Wilks, A. R. (1988)
Johnson, N. L., Kotz, S. and Balakrishnan, N. (1995)
## Examplesrequire(graphics) dchisq(1, df = 1:3) pchisq(1, df = 3) pchisq(1, df = 3, ncp = 0:4) # includes the above x <- 1:10 ## Chi-squared(df = 2) is a special exponential distribution all.equal(dchisq(x, df = 2), dexp(x, 1/2)) all.equal(pchisq(x, df = 2), pexp(x, 1/2)) ## non-central RNG -- df = 0 with ncp > 0: Z0 has point mass at 0! Z0 <- rchisq(100, df = 0, ncp = 2.) graphics::stem(Z0) ## visual testing ## do P-P plots for 1000 points at various degrees of freedom L <- 1.2; n <- 1000; pp <- ppoints(n) op <- par(mfrow = c(3,3), mar = c(3,3,1,1)+.1, mgp = c(1.5,.6,0), oma = c(0,0,3,0)) for(df in 2^(4*rnorm(9))) { plot(pp, sort(pchisq(rr <- rchisq(n, df = df, ncp = L), df = df, ncp = L)), ylab = "pchisq(rchisq(.),.)", pch = ".") mtext(paste("df = ", formatC(df, digits = 4)), line = -2, adj = 0.05) abline(0, 1, col = 2) } mtext(expression("P-P plots : Noncentral "* chi^2 *"(n=1000, df=X, ncp= 1.2)"), cex = 1.5, font = 2, outer = TRUE) par(op) ## "analytical" test lam <- seq(0, 100, by = .25) p00 <- pchisq(0, df = 0, ncp = lam) p.0 <- pchisq(1e-300, df = 0, ncp = lam) stopifnot(all.equal(p00, exp(-lam/2)), all.equal(p.0, exp(-lam/2))) |

Recent Queries With This Operation |
---|

No queries made on this operation yet. |

Recent Queries | App/Dataset | By | Date |
---|---|---|---|

Picostat Output - Boxplot | R Dataset / Package datasets / JohnsonJohnson | huiminlol | June 27, 2020 - 6:47 AM |

Picostat Output - Boxplot | R Dataset / Package datasets / JohnsonJohnson | huiminlol | June 27, 2020 - 6:47 AM |

Picostat Output - Boxplot | R Dataset / Package datasets / JohnsonJohnson | huiminlol | June 27, 2020 - 6:46 AM |

Picostat Output - Median | R Dataset / Package MASS / Sitka89 | jordanjmartins | June 25, 2020 - 2:24 PM |

Picostat Output - Hollow Histogram | R Dataset / Package MASS / Sitka89 | jordanjmartins | June 25, 2020 - 1:57 PM |

#### Pagination

Picostat How-To Article |
---|

Unary and Binary Operations |

The Real Number System |

The Real Number Axioms |

Sets, Relations and Functions |

Sets |

#### Pagination

Title | Authored on | Content type |
---|---|---|

R Dataset / Package Zelig / sna.ex | March 9, 2018 - 1:06 PM | Dataset |

R Dataset / Package Stat2Data / Caterpillars | March 9, 2018 - 1:06 PM | Dataset |

R Dataset / Package robustbase / phosphor | March 9, 2018 - 1:06 PM | Dataset |

R Dataset / Package Ecdat / Yogurt | March 9, 2018 - 1:06 PM | Dataset |

R Dataset / Package Stat2Data / Political | March 9, 2018 - 1:06 PM | Dataset |