r:probability
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| r:probability [2016/10/19 01:29] – hkimscil | r:probability [2026/04/14 23:24] (current) – [Normal distribution functions] hkimscil | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Normal distribution functions ====== | ||
| ^ Function | ^ Function | ||
| Line 21: | Line 22: | ||
| | Chi-squared (Chisquare) | | Chi-squared (Chisquare) | ||
| | Exponential | | Exponential | ||
| - | | F | f | df1 and df2 = degrees of freedom | + | | <fc # |
| | Gamma | gamma | rate; either rate or scale | | | Gamma | gamma | rate; either rate or scale | | ||
| | Log-normal (Lognormal) | | Log-normal (Lognormal) | ||
| | Logistic | | Logistic | ||
| | Normal | | Normal | ||
| - | | Student’s t (TDist) | + | | <fc # |
| | Uniform | | Uniform | ||
| | Weibull | | Weibull | ||
| | Wilcoxon | | Wilcoxon | ||
| + | ===== pnorm, qnorm ===== | ||
| + | |||
| + | <WRAP info> | ||
| + | Normal distribution | ||
| + | $ f(x) = \frac{1}{\sigma \sqrt{2\pi}} e^{\frac{-(x-\mu)^2}{2\sigma^2}} $ | ||
| + | |||
| + | Assume that the test scores of a college entrance exam fits a normal distribution. Furthermore, | ||
| + | |||
| + | < | ||
| + | [1] 0.5 | ||
| + | |||
| + | > pnorm(1.96) | ||
| + | [1] 0.9750021 | ||
| + | |||
| + | > pnorm(1.96)-pnorm(-1.96) | ||
| + | [1] 0.9500042 | ||
| + | |||
| + | > pnorm(c(1.96, | ||
| + | [1] 0.9750021 0.0249979 | ||
| + | |||
| + | > pnorm(84, mean=72, sd=15.2, lower.tail=FALSE) | ||
| + | [1] .2149176 | ||
| + | |||
| + | > qnorm(.2149176, | ||
| + | [1] 84 | ||
| + | </ | ||
| + | ===== rnorm ===== | ||
| + | Random samples from a normal distribution | ||
| + | < | ||
| + | > rnorm(50) | ||
| + | [1] -0.778662882 -0.389476396 -2.033798329 -0.982373104 | ||
| + | [6] -2.103864629 -0.381418049 | ||
| + | [11] -1.879263193 -1.239189026 | ||
| + | [16] 1.795551228 -1.322138481 -0.276086413 -0.743976510 -1.070050125 | ||
| + | [21] -0.349525474 | ||
| + | [26] -0.538926447 | ||
| + | [31] -0.664914510 | ||
| + | [36] -0.268632965 | ||
| + | [41] -0.153716777 | ||
| + | [46] 0.603955311 -0.568653469 -0.891303117 -2.525145692 | ||
| + | |||
| + | |||
| + | ===== qt, pt ===== | ||
| + | |||
| + | <WRAP info> | ||
| + | $t = \frac{Z}{\sqrt{\frac{V}{m}}}$ | ||
| + | < | ||
| + | [1] -2.5706 | ||
| + | |||
| + | > qt(c(0.025, 0.975), df=10) | ||
| + | [1] -2.228139 | ||
| + | |||
| + | > qt(c(0.025, 0.975), df=20) | ||
| + | [1] -2.085963 | ||
| + | |||
| + | > qt(c(0.025, 0.975), df=30) | ||
| + | [1] -2.042272 | ||
| + | |||
| + | > qt(c(0.025, 0.975), df=40) | ||
| + | [1] -2.021075 | ||
| + | |||
| + | > qt(c(0.025, 0.975), df=50) | ||
| + | [1] -2.008559 | ||
| + | |||
| + | . . . . . . | ||
| + | |||
| + | > qt(c(0.025, 0.975), df=50000) | ||
| + | [1] -1.960011 | ||
| + | |||
| + | </ | ||
| + | </ | ||
| ====== Counting the Number of Combinations ====== | ====== Counting the Number of Combinations ====== | ||
| Line 92: | Line 164: | ||
| </ | </ | ||
| - | < | + | |
| + | < | ||
| [1] -11.195667 | [1] -11.195667 | ||
| </ | </ | ||
| Line 131: | Line 204: | ||
| Replacement in random sampling: Specify replace=TRUE to sample with replacement. | Replacement in random sampling: Specify replace=TRUE to sample with replacement. | ||
| + | |||
| + | < | ||
| + | sample(world.series$year, | ||
| + | [1] 1906 1963 1966 1928 1905 1924 1961 1959 1927 1934 | ||
| + | set.seed(121) | ||
| + | sample(world.series$year, | ||
| + | [1] 1906 1963 1966 1928 1905 1924 1961 1959 1927 1934 | ||
| + | </ | ||
| + | |||
| ====== Generating Random Sequences ====== | ====== Generating Random Sequences ====== | ||
| Line 197: | Line 279: | ||
| </ | </ | ||
| - | < | + | < |
| + | [1] 0.8413447 | ||
| + | </ | ||
| + | |||
| + | < | ||
| [1] -1.959964 | [1] -1.959964 | ||
| </ | </ | ||
r/probability.1476840550.txt.gz · Last modified: by hkimscil
