Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions lib/node_modules/@stdlib/stats/base/dists/logistic/cdf/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,73 @@ for ( i = 0; i < 10; i++ ) {
y = cdf( x, mu, s );
console.log( 'x: %d, µ: %d, s: %d, F(x;µ,s): %d', x, mu, s, y );
}
// Importing the logistic distribution namespace
var logistic = require('@stdlib/stats/base/dists/logistic');

// Creating a logistic distribution object with mean (mu) = 2.0 and scale (s) = 4.0
var dist = new logistic.Logistic(2.0, 4.0);

// To calculate the probability density function (PDF) at x = 2.0
var pdfValue = dist.pdf(2.0);
console.log('PDF at x = 2.0:', pdfValue); // Output: PDF at x = 2.0: 0.0625

// To calculate the cumulative distribution function (CDF) at x = 3.0
var cdfValue = logistic.cdf(3.0, 2.0, 4.0);
console.log('CDF at x = 3.0:', cdfValue); // Output: CDF at x = 3.0: 0.5

// To calculate the logarithm of the cumulative distribution function (logCDF) at x = 1.0
var logCDFValue = logistic.logcdf(1.0, 2.0, 4.0);
console.log('LogCDF at x = 1.0:', logCDFValue);

// To calculate the logarithm of the probability density function (logPDF) at x = 4.0
var logPDFValue = logistic.logpdf(4.0, 2.0, 4.0);
console.log('LogPDF at x = 4.0:', logPDFValue);

// To calculate the moment-generating function (MGF) at t = 0.5
var mgfValue = logistic.mgf(0.5, 2.0, 4.0);
console.log('MGF at t = 0.5:', mgfValue);

// To calculate the quantile function at p = 0.95
var quantileValue = logistic.quantile(0.95, 2.0, 4.0);
console.log('Quantile at p = 0.95:', quantileValue);

// To calculate the differential entropy
var entropyValue = logistic.entropy(2.0, 4.0);
console.log('Differential Entropy:', entropyValue);

// To calculate the excess kurtosis
var kurtosisValue = logistic.kurtosis(2.0, 4.0);
console.log('Excess Kurtosis:', kurtosisValue);

// To calculate the expected value (mean)
var meanValue = logistic.mean(2.0, 4.0);
console.log('Expected Value (Mean):', meanValue);

// To calculate the median
var medianValue = logistic.median(2.0, 4.0);
console.log('Median:', medianValue);

// To calculate the mode
var modeValue = logistic.mode(2.0, 4.0);
console.log('Mode:', modeValue);

// To calculate the skewness
var skewnessValue = logistic.skewness(2.0, 4.0);
console.log('Skewness:', skewnessValue);

// To calculate the standard deviation
var stdevValue = logistic.stdev(2.0, 4.0);
console.log('Standard Deviation:', stdevValue);

// To calculate the variance
var varianceValue = logistic.variance(2.0, 4.0);
console.log('Variance:', varianceValue);

```

</section>


<!-- /.examples -->

<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
Expand Down
29 changes: 29 additions & 0 deletions lib/node_modules/@stdlib/stats/base/dists/triangular/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ var y = dist.quantile( 0.5 );

y = dist.quantile( 1.9 );
// returns NaN


```

</section>
Expand All @@ -109,13 +111,40 @@ y = dist.quantile( 1.9 );

<!-- TODO: better examples -->


<!-- eslint no-undef: "error" -->

```javascript
var objectKeys = require( '@stdlib/utils/keys' );
var triangular = require( '@stdlib/stats/base/dists/triangular' );

console.log( objectKeys( triangular ) );


// Basic Usage: Calculate and print the mean, median, and mode
console.log('Mean:', dist.mean());
// returns Mean: 3.0

console.log('Median:', dist.median());
// returns Median: 3.0

console.log('Mode:', dist.mode());
// returns Mode: 3.0

// Probability Density Function (PDF): Calculate the PDF at x=3.5
var pdfValue = dist.pdf(3.5);
console.log('PDF at x=3.5:', pdfValue);
// returns PDF at x=3.5: 0.4

// Cumulative Distribution Function (CDF): Calculate the CDF at x=3.5
var cdfValue = dist.cdf(3.5);
console.log('CDF at x=3.5:', cdfValue);
// returns CDF at x=3.5: 0.5

// Quantile Function: Find the quantile for p=0.5
var quantileValue = dist.quantile(0.5);
console.log('Quantile for p=0.5:', quantileValue);
// returns Quantile for p=0.5: 3.0
```

</section>
Expand Down