time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

README.md (3753B)


      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 # boxcox
     22 
     23 > Compute 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 The one-parameter [Box-Cox transformation][box-cox-transformation] is defined as 
     30 
     31 <!-- <equation class="equation" label="eq:boxcox_transformation_one_parameter" align="center" raw="y^{\lambda} = \begin{cases}\frac{y^{\lambda} - 1}{\lambda} & \textrm{if}\ \lambda \neq 0 \\ \ln(y) & \textrm{if}\ \lambda = 0 \end{cases}" alt="One-Parameter Box-Cox Transformation"> -->
     32 
     33 <div class="equation" align="center" data-raw-text="y^{\lambda} = \begin{cases}\frac{y^{\lambda} - 1}{\lambda} & \textrm{if}\ \lambda \neq 0 \\ \ln(y) & \textrm{if}\ \lambda = 0 \end{cases}" data-equation="eq:boxcox_transformation_one_parameter">
     34     <img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@1cd982bdbe87913bbb66e9d6a79b0acb0fb89616/lib/node_modules/@stdlib/math/base/special/boxcox/docs/img/equation_boxcox_transformation_one_parameter.svg" alt="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 boxcox = require( '@stdlib/math/base/special/boxcox' );
     52 ```
     53 
     54 #### boxcox( x, lambda )
     55 
     56 Computes a one-parameter [Box-Cox transformation][box-cox-transformation].
     57 
     58 ```javascript
     59 var v = boxcox( 1.0, 2.5 );
     60 // returns 0.0
     61 
     62 v = boxcox( 4.0, 2.5 );
     63 // returns 12.4
     64 
     65 v = boxcox( 10.0, 2.5 );
     66 // returns ~126.0911
     67 
     68 v = boxcox( 2.0, 0.0 );
     69 // returns ~0.6931
     70 
     71 v = boxcox( -1.0, 2.5 );
     72 // returns NaN
     73 
     74 v = boxcox( 0.0, -1.0 );
     75 // returns -Infinity
     76 ```
     77 
     78 </section>
     79 
     80 <!-- /.usage -->
     81 
     82 <!-- Package usage examples. -->
     83 
     84 <section class="examples">
     85 
     86 ## Examples
     87 
     88 <!-- eslint no-undef: "error" -->
     89 
     90 ```javascript
     91 var incrspace = require( '@stdlib/array/incrspace' );
     92 var boxcox = require( '@stdlib/math/base/special/boxcox' );
     93 
     94 var x = incrspace( -1.0, 10.0, 1.0 );
     95 var l = incrspace( -0.5, 5.0, 0.5 );
     96 var b;
     97 var i;
     98 var j;
     99 
    100 for ( i = 0; i < x.length; i++ ) {
    101     for ( j = 0; j < l.length; j++ ) {
    102         b = boxcox( x[ i ], l[ j ] );
    103         console.log( 'boxcox(%d, %d) = %d', x[ i ], l[ j ], b );
    104     }
    105 }
    106 ```
    107 
    108 </section>
    109 
    110 <!-- /.examples -->
    111 
    112 <!-- 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. -->
    113 
    114 <section class="references">
    115 
    116 ## References
    117 
    118 -   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>.
    119 
    120 </section>
    121 
    122 <!-- /.references -->
    123 
    124 <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
    125 
    126 <section class="links">
    127 
    128 [box-cox-transformation]: https://en.wikipedia.org/wiki/Power_transform#Box-Cox_transformation
    129 
    130 </section>
    131 
    132 <!-- /.links -->