time-to-botec

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

README.md (3874B)


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