README.md (3972B)
1 <!-- 2 3 @license Apache-2.0 4 5 Copyright (c) 2018 The Stdlib Authors. 6 7 Licensed under the Apache License, Version 2.0 (the "License"); 8 you may not use this file except in compliance with the License. 9 You may obtain a copy of the License at 10 11 http://www.apache.org/licenses/LICENSE-2.0 12 13 Unless required by applicable law or agreed to in writing, software 14 distributed under the License is distributed on an "AS IS" BASIS, 15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 See the License for the specific language governing permissions and 17 limitations under the License. 18 19 --> 20 21 # boxcoxinv 22 23 > Compute the inverse of a one-parameter [Box-Cox transformation][box-cox-transformation]. 24 25 <!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> 26 27 <section class="intro"> 28 29 To compute the inverse of a one-parameter [Box-Cox transformation][box-cox-transformation], one finds the `x` such that 30 31 <!-- <equation class="equation" label="eq:inverse_boxcox_transformation_one_parameter" align="center" raw="y = \begin{cases}\frac{x^{\lambda} - 1}{\lambda} & \textrm{if}\ \lambda \neq 0 \\ \ln(x) & \textrm{if}\ \lambda = 0 \end{cases}" alt="Inverse One-Parameter Box-Cox Transformation"> --> 32 33 <div class="equation" align="center" data-raw-text="y = \begin{cases}\frac{x^{\lambda} - 1}{\lambda} & \textrm{if}\ \lambda \neq 0 \\ \ln(x) & \textrm{if}\ \lambda = 0 \end{cases}" data-equation="eq:inverse_boxcox_transformation_one_parameter"> 34 <img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@1f2eca12bb7f86547d4b5b335364419bac5b97fb/lib/node_modules/@stdlib/math/base/special/boxcoxinv/docs/img/equation_inverse_boxcox_transformation_one_parameter.svg" alt="Inverse One-Parameter Box-Cox Transformation" /> 35 <br> 36 </div> 37 38 <!-- </equation> --> 39 40 </section> 41 42 <!-- /.intro --> 43 44 <!-- Package usage documentation. --> 45 46 <section class="usage"> 47 48 ## Usage 49 50 ```javascript 51 var boxcoxinv = require( '@stdlib/math/base/special/boxcoxinv' ); 52 ``` 53 54 #### boxcoxinv( y, lambda ) 55 56 Computes the inverse of a one-parameter [Box-Cox transformation][box-cox-transformation]. 57 58 ```javascript 59 var v = boxcoxinv( 1.0, 2.5 ); 60 // returns ~1.6505 61 62 v = boxcoxinv( 4.0, 2.5 ); 63 // returns ~2.6095 64 65 v = boxcoxinv( 10.0, 2.5 ); 66 // returns ~3.6812 67 68 v = boxcoxinv( 2.0, 0.0 ); 69 // returns ~7.3891 70 71 v = boxcoxinv( -1.0, 2.5 ); 72 // returns NaN 73 74 v = boxcoxinv( 0.0, -1.0 ); 75 // returns 1.0 76 77 v = boxcoxinv( 1.0, NaN ); 78 // returns NaN 79 80 v = boxcoxinv( NaN, 3.1 ); 81 // returns NaN 82 ``` 83 84 </section> 85 86 <!-- /.usage --> 87 88 <!-- Package usage examples. --> 89 90 <section class="examples"> 91 92 ## Examples 93 94 <!-- eslint no-undef: "error" --> 95 96 ```javascript 97 var incrspace = require( '@stdlib/array/incrspace' ); 98 var boxcoxinv = require( '@stdlib/math/base/special/boxcoxinv' ); 99 100 var y = incrspace( -1.0, 10.0, 1.0 ); 101 var l = incrspace( -0.5, 5.0, 0.5 ); 102 var b; 103 var i; 104 var j; 105 106 for ( i = 0; i < y.length; i++ ) { 107 for ( j = 0; j < l.length; j++ ) { 108 b = boxcoxinv( y[ i ], l[ j ] ); 109 console.log( 'boxcoxinv(%d, %d) = %d', y[ i ], l[ j ], b ); 110 } 111 } 112 ``` 113 114 </section> 115 116 <!-- /.examples --> 117 118 <!-- 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. --> 119 120 <section class="references"> 121 122 ## References 123 124 - Box, G. E. P., and D. R. Cox. 1964. "An Analysis of Transformations." _Journal of the Royal Statistical Society. Series B (Methodological)_ 26 (2). \[Royal Statistical Society, Wiley]: 211–52. <http://www.jstor.org/stable/2984418>. 125 126 </section> 127 128 <!-- /.references --> 129 130 <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> 131 132 <section class="links"> 133 134 [box-cox-transformation]: https://en.wikipedia.org/wiki/Power_transform#Box-Cox_transformation 135 136 </section> 137 138 <!-- /.links -->