|
| 1 | +# Inverse Gamma |
| 2 | + |
| 3 | +> Inverse gamma distribution constructor. |
| 4 | +
|
| 5 | + |
| 6 | +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> |
| 7 | + |
| 8 | +<section class="intro"> |
| 9 | + |
| 10 | +</section> |
| 11 | + |
| 12 | +<!-- /.intro --> |
| 13 | + |
| 14 | +<!-- Package usage documentation. --> |
| 15 | + |
| 16 | +<section class="usage"> |
| 17 | + |
| 18 | +## Usage |
| 19 | + |
| 20 | +``` javascript |
| 21 | +var InvGamma = require( '@stdlib/math/base/dist/invgamma/ctor' ); |
| 22 | +``` |
| 23 | + |
| 24 | +#### InvGamma( \[alpha, beta\] ) |
| 25 | + |
| 26 | +Returns an [inverse gamma][invgamma] distribution object. |
| 27 | + |
| 28 | +``` javascript |
| 29 | +var invgamma = new InvGamma(); |
| 30 | + |
| 31 | +var mode = invgamma.mode; |
| 32 | +// returns 0.5 |
| 33 | +``` |
| 34 | + |
| 35 | +By default, `alpha = 1.0` and `beta = 1.0`. To create a distribution having a different `alpha` (shape parameter) and `beta` (rate parameter), provide parameter values. |
| 36 | + |
| 37 | +``` javascript |
| 38 | +var invgamma = new InvGamma( 2.0, 4.0 ); |
| 39 | + |
| 40 | +var mu = invgamma.mean; |
| 41 | +// returns 4.0 |
| 42 | +``` |
| 43 | + |
| 44 | +--- |
| 45 | + |
| 46 | +## invgamma |
| 47 | + |
| 48 | +An [inverse gamma][invgamma] distribution object has the following properties and methods... |
| 49 | + |
| 50 | +### Writable Properties |
| 51 | + |
| 52 | +#### invgamma.alpha |
| 53 | + |
| 54 | +Shape parameter of the distribution. `alpha` __must__ be a positive number. |
| 55 | + |
| 56 | +``` javascript |
| 57 | +var invgamma = new InvGamma(); |
| 58 | + |
| 59 | +var alpha = invgamma.alpha |
| 60 | +// returns 1.0 |
| 61 | + |
| 62 | +invgamma.alpha = 3.0; |
| 63 | + |
| 64 | +alpha = invgamma.alpha; |
| 65 | +// returns 3.0 |
| 66 | +``` |
| 67 | + |
| 68 | +#### invgamma.beta |
| 69 | + |
| 70 | +Rate parameter of the distribution. `beta` __must__ be a positive number. |
| 71 | + |
| 72 | +``` javascript |
| 73 | +var invgamma = new InvGamma( 2.0, 4.0 ); |
| 74 | + |
| 75 | +var b = invgamma.beta |
| 76 | +// returns 4.0 |
| 77 | + |
| 78 | +invgamma.beta = 3.0; |
| 79 | + |
| 80 | +b = invgamma.beta; |
| 81 | +// returns 3.0 |
| 82 | +``` |
| 83 | + |
| 84 | +--- |
| 85 | + |
| 86 | +### Computed Properties |
| 87 | + |
| 88 | +#### InvGamma.prototype.kurtosis |
| 89 | + |
| 90 | +Returns the [excess kurtosis][kurtosis]. |
| 91 | + |
| 92 | +``` javascript |
| 93 | +var invgamma = new InvGamma( 6.0, 12.0 ); |
| 94 | + |
| 95 | +var kurtosis = invgamma.kurtosis; |
| 96 | +// returns 19.0 |
| 97 | +``` |
| 98 | + |
| 99 | +#### InvGamma.prototype.mean |
| 100 | + |
| 101 | +Returns the [expected value][expected-value]. |
| 102 | + |
| 103 | +``` javascript |
| 104 | +var invgamma = new InvGamma( 4.0, 12.0 ); |
| 105 | + |
| 106 | +var mu = invgamma.mean; |
| 107 | +// returns 4.0 |
| 108 | +``` |
| 109 | + |
| 110 | +#### InvGamma.prototype.mode |
| 111 | + |
| 112 | +Returns the [mode][mode]. |
| 113 | + |
| 114 | +``` javascript |
| 115 | +var invgamma = new InvGamma( 4.0, 12.0 ); |
| 116 | + |
| 117 | +var mode = invgamma.mode; |
| 118 | +// returns 2.4 |
| 119 | +``` |
| 120 | + |
| 121 | +#### InvGamma.prototype.skewness |
| 122 | + |
| 123 | +Returns the [skewness][skewness]. |
| 124 | + |
| 125 | +``` javascript |
| 126 | +var invgamma = new InvGamma( 4.0, 12.0 ); |
| 127 | + |
| 128 | +var skewness = invgamma.skewness; |
| 129 | +// returns ~5.657 |
| 130 | +``` |
| 131 | + |
| 132 | +#### InvGamma.prototype.variance |
| 133 | + |
| 134 | +Returns the [variance][variance]. |
| 135 | + |
| 136 | +``` javascript |
| 137 | +var invgamma = new InvGamma( 4.0, 12.0 ); |
| 138 | + |
| 139 | +var s2 = invgamma.variance; |
| 140 | +// returns 8.0 |
| 141 | +``` |
| 142 | + |
| 143 | +--- |
| 144 | + |
| 145 | +### Methods |
| 146 | + |
| 147 | +#### InvGamma.prototype.cdf( x ) |
| 148 | + |
| 149 | +Evaluates the [cumulative distribution function][cdf] (CDF). |
| 150 | + |
| 151 | +``` javascript |
| 152 | +var invgamma = new InvGamma( 2.0, 4.0 ); |
| 153 | + |
| 154 | +var y = invgamma.cdf( 0.5 ); |
| 155 | +// returns ~0.003 |
| 156 | +``` |
| 157 | + |
| 158 | +#### InvGamma.prototype.pdf( x ) |
| 159 | + |
| 160 | +Evaluates the [probability density function][pdf] (PDF). |
| 161 | + |
| 162 | +``` javascript |
| 163 | +var invgamma = new InvGamma( 2.0, 4.0 ); |
| 164 | + |
| 165 | +var y = invgamma.pdf( 0.8 ); |
| 166 | +// returns ~0.211 |
| 167 | +``` |
| 168 | + |
| 169 | +#### InvGamma.prototype.quantile( p ) |
| 170 | + |
| 171 | +Evaluates the [quantile function][quantile-function] at probability `p`. |
| 172 | + |
| 173 | +``` javascript |
| 174 | +var invgamma = new InvGamma( 2.0, 4.0 ); |
| 175 | + |
| 176 | +var y = invgamma.quantile( 0.5 ); |
| 177 | +// returns ~2.383 |
| 178 | + |
| 179 | +y = quantile( 1.9 ); |
| 180 | +// returns NaN |
| 181 | +``` |
| 182 | + |
| 183 | +</section> |
| 184 | + |
| 185 | +<!-- /.usage --> |
| 186 | + |
| 187 | +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> |
| 188 | + |
| 189 | +<section class="notes"> |
| 190 | + |
| 191 | +</section> |
| 192 | + |
| 193 | +<!-- /.notes --> |
| 194 | + |
| 195 | +<!-- Package usage examples. --> |
| 196 | + |
| 197 | +--- |
| 198 | + |
| 199 | +<section class="examples"> |
| 200 | + |
| 201 | +## Examples |
| 202 | + |
| 203 | +``` javascript |
| 204 | +var InvGamma = require( '@stdlib/math/base/dist/invgamma/ctor' ); |
| 205 | + |
| 206 | +var invgamma = new InvGamma( 3.0, 4.0 ); |
| 207 | + |
| 208 | +var mu = invgamma.mean; |
| 209 | +// returns 2.0 |
| 210 | + |
| 211 | +var mode = invgamma.mode; |
| 212 | +// returns 1.0 |
| 213 | + |
| 214 | +var s2 = invgamma.variance; |
| 215 | +// returns 4.0 |
| 216 | + |
| 217 | +var y = invgamma.cdf( 0.8 ); |
| 218 | +// returns ~0.125 |
| 219 | +``` |
| 220 | + |
| 221 | +</section> |
| 222 | + |
| 223 | +<!-- /.examples --> |
| 224 | + |
| 225 | +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> |
| 226 | + |
| 227 | +<section class="references"> |
| 228 | + |
| 229 | +</section> |
| 230 | + |
| 231 | +<!-- /.references --> |
| 232 | + |
| 233 | +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> |
| 234 | + |
| 235 | +<section class="links"> |
| 236 | + |
| 237 | +[invgamma]: https://en.wikipedia.org/wiki/Inverse_Gamma_distribution |
| 238 | + |
| 239 | +[cdf]: https://en.wikipedia.org/wiki/Cumulative_distribution_function |
| 240 | +[pdf]: https://en.wikipedia.org/wiki/Probability_density_function |
| 241 | +[quantile-function]: https://en.wikipedia.org/wiki/Quantile_function |
| 242 | + |
| 243 | +[expected-value]: https://en.wikipedia.org/wiki/Expected_value |
| 244 | +[kurtosis]: https://en.wikipedia.org/wiki/Kurtosis |
| 245 | +[mode]: https://en.wikipedia.org/wiki/Mode_%28statistics%29 |
| 246 | +[skewness]: https://en.wikipedia.org/wiki/Skewness |
| 247 | +[variance]: https://en.wikipedia.org/wiki/Variance |
| 248 | + |
| 249 | +</section> |
| 250 | + |
| 251 | +<!-- /.links --> |
0 commit comments