Skip to content
Snippets Groups Projects
Commit c21bdea7 authored by Steve Reis's avatar Steve Reis
Browse files

fix(exareme): Two way anova handler issue

parent 046bb067
No related branches found
No related tags found
2 merge requests!110Official release,!109Update RC branch with last fixes
Pipeline #810653660 passed
......@@ -33,21 +33,21 @@ const domain: Domain = {
const data = [
{
terms: [
'parkinsonbroadcategory',
'gender',
'parkinsonbroadcategory:gender',
'parkinsonbroadcategory',
'gender:parkinsonbroadcategory',
'Residuals',
],
sum_sq: [
0.7427619881331298, 0.004764818481136857, 0.008175662839327025,
5.6058179597692295,
122.2949665988383, 33.327112053403425, 0.8516104180441744,
1801.7985931306575,
],
df: [2, 1, 2, 74],
f_stat: [4.902441313320338, 0.06289832636995628, 0.05396171035628005, null],
df: [1.0, 2.0, 2.0, 708.0],
f_stat: [48.05466975170338, 6.547789365517223, 0.16731619679191115, null],
f_pvalue: [
0.010014025893247736,
0.8026673646098741,
0.9475056310046991,
9.343970042152705e-12,
0.0015216347633810745,
0.8459655267774153,
null,
],
},
......@@ -67,6 +67,6 @@ describe('Anova 2 way result handler', () => {
expect(exp.results.length).toBeGreaterThanOrEqual(1);
expect(summaryTable.data[0].length).toEqual(4);
expect(summaryTable.data.length).toEqual(4);
});
});
......@@ -10,14 +10,14 @@ import BaseHandler from '../base.handler';
const NUMBER_PRECISION = 4;
export default class AnovaTwoWayHandler extends BaseHandler {
public static readonly ALGO_NAME = 'anova_twoway';
public static readonly ALGO_NAME = 'anova';
private canHandle(algorithm: string, data: any): boolean {
return (
algorithm === AnovaTwoWayHandler.ALGO_NAME &&
!!data &&
!!data[0] &&
!!data[0]['terms']
algorithm.toLowerCase() === AnovaTwoWayHandler.ALGO_NAME &&
data &&
data[0] &&
data[0]['terms']
);
}
......@@ -29,15 +29,13 @@ export default class AnovaTwoWayHandler extends BaseHandler {
name,
type: 'string',
})),
data: [
data['terms'].map((term: string, index: number) => [
variables.find((variable) => variable.id == term)?.label ?? term,
data['df'][index]?.toPrecision(NUMBER_PRECISION) ?? '',
data['sum_sq'][index]?.toPrecision(NUMBER_PRECISION) ?? '',
data['f_stat'][index]?.toPrecision(NUMBER_PRECISION) ?? '',
data['f_pvalue'][index]?.toPrecision(NUMBER_PRECISION) ?? '',
]),
],
data: data['terms'].map((term: string, index: number) => [
variables.find((variable) => variable.id == term)?.label ?? term,
data['df'][index]?.toPrecision(NUMBER_PRECISION) ?? '',
data['sum_sq'][index]?.toPrecision(NUMBER_PRECISION) ?? '',
data['f_stat'][index]?.toPrecision(NUMBER_PRECISION) ?? '',
data['f_pvalue'][index]?.toPrecision(NUMBER_PRECISION) ?? '',
]),
};
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment