Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let makeIntervals = ({values, variances, statistic, type, family, alpha, n, ddof, MSE, m}) => {
// MSE is already included in the coefficient variance-covariance matrix
let stdErr = variances.map({
mean: _ => _,
prediction: x => (MSE * 1 / (m || 1)) + x,
}[type]).map(Math.sqrt);
let g = values.length;
let statValue = {
// simultaneous region over regression surface
workingHotelling: Math.sqrt(ddof * jStat.centralF.inv(1 - alpha, ddof, n - ddof)),
// simultaneous set
scheffe: Math.sqrt(g * jStat.centralF.inv(1 - alpha, g, n - ddof)),
bonferroni: jStat.studentt.inv(1 - alpha / (2 * g), n - ddof),
// pointwise
t: jStat.studentt.inv(1 - alpha / 2, n - ddof)
}[statistic];
let invLink = {
gaussian: _ => _,
poisson: x => Math.exp(x),
exponential: x => -1 / x,
gamma: x => -1 / x,
binomial: x => 1 / (1 + Math.exp(x))
}[family];
let makeIntervals = ({values, variances, statistic, type, family, alpha, n, ddof, MSE, m}) => {
// MSE is already included in the coefficient variance-covariance matrix
let stdErr = variances.map({
mean: _ => _,
prediction: x => (MSE * 1 / (m || 1)) + x,
}[type]).map(Math.sqrt);
let g = values.length;
let statValue = {
// simultaneous region over regression surface
workingHotelling: Math.sqrt(ddof * jStat.centralF.inv(1 - alpha, ddof, n - ddof)),
// simultaneous set
scheffe: Math.sqrt(g * jStat.centralF.inv(1 - alpha, g, n - ddof)),
bonferroni: jStat.studentt.inv(1 - alpha / (2 * g), n - ddof),
// pointwise
t: jStat.studentt.inv(1 - alpha / 2, n - ddof)
}[statistic];
let invLink = {
gaussian: _ => _,
poisson: x => Math.exp(x),
exponential: x => -1 / x,
gamma: x => -1 / x,
binomial: x => 1 / (1 + Math.exp(x))
}[family];
return values
.map((val, i) => [-1, 1].map(sign => invLink(val + sign * statValue * stdErr[i])).sort())
exports.F.DIST.RT = function (x, d1, d2) {
if (arguments.length !== 3) {
return Error(ERROR_NA);
}
if (x < 0 || d1 < 1 || d2 < 1) {
return Error(ERROR_NUM);
}
if ((typeof x !== 'number') || (typeof d1 !== 'number') || (typeof d2 !== 'number')) {
return Error(ERROR_VALUE);
}
return 1 - jStat.centralF.cdf(x, d1, d2);
};
exports.F.DIST = function (x, d1, d2, cumulative) {
x = parseNumber(x);
d1 = parseNumber(d1);
d2 = parseNumber(d2);
if (anyIsError(x, d1, d2)) {
return Error(ERROR_VALUE);
}
if (cumulative === undefined){
cumulative = true
}
if (cumulative === 'FALSE'){
cumulative = false
}
return (cumulative) ? jStat.centralF.cdf(x, d1, d2) : jStat.centralF.pdf(x, d1, d2);
};
exports.F.INV.RT = function (p, d1, d2) {
if (arguments.length !== 3) {
return Error(ERROR_NA);
}
if (p < 0 || p > 1 || d1 < 1 || d1 > Math.pow(10, 10) || d2 < 1 || d2 > Math.pow(10, 10)) {
return Error(ERROR_NUM);
}
if ((typeof p !== 'number') || (typeof d1 !== 'number') || (typeof d2 !== 'number')) {
return Error(ERROR_VALUE);
}
return jStat.centralF.inv(1.0 - p, d1, d2);
};