Skip to content

Commit

Permalink
Fixes for the RM Anova
Browse files Browse the repository at this point in the history
some clean up and fixes for the RM Anova
  • Loading branch information
dropmann committed Feb 7, 2024
1 parent 452ca6c commit 7f49a26
Show file tree
Hide file tree
Showing 10 changed files with 507 additions and 470 deletions.
29 changes: 1 addition & 28 deletions jamovi/anovarm.u.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
name: anovaRM
title: Repeated Measures ANOVA
jus: '2.0'
jus: '3.0'
stage: 0
compilerMode: tame
events:
update: './anovarm.events::update'
children:
- type: VariableSupplier
name: variablesupplier
Expand All @@ -14,15 +12,11 @@ children:
- type: RMAnovaFactorsBox
name: rm
label: Repeated Measures Factors
events:
change: './anovarm.events::onChange_rm'
- type: TargetLayoutBox
children:
- type: ListBox
name: rmCells
height: large
events:
change: './anovarm.events::onChange_rmCells'
templateName: rmcell-template
template:
type: LayoutBox
Expand All @@ -49,17 +43,13 @@ children:
height: small
itemDropBehaviour: insert
isTarget: true
events:
change: './anovarm.events::onChange_bs'
- type: TargetLayoutBox
children:
- type: VariablesListBox
name: cov
height: small
itemDropBehaviour: insert
isTarget: true
events:
change: './anovarm.events::onChange_cov'
- type: LayoutBox
margin: large
stretchFactor: 1
Expand Down Expand Up @@ -118,8 +108,6 @@ children:
format: term
persistentItems: true
stretchFactor: 1
events:
update: './anovarm.events::onUpdate_rmcModelSupplier'
children:
- type: TargetLayoutBox
transferAction: interactions
Expand All @@ -129,8 +117,6 @@ children:
valueFilter: unique
itemDropBehaviour: emptyspace
isTarget: true
events:
change: './anovarm.events::onChange_rmTerms'
template:
type: TermLabel
- type: Supplier
Expand All @@ -139,8 +125,6 @@ children:
format: term
persistentItems: true
stretchFactor: 1
events:
update: './anovarm.events::onUpdate_bscModelSupplier'
children:
- type: TargetLayoutBox
transferAction: interactions
Expand All @@ -150,8 +134,6 @@ children:
valueFilter: unique
itemDropBehaviour: emptyspace
isTarget: true
events:
change: './anovarm.events::onChange_bsTerms'
template:
type: TermLabel
- type: LayoutBox
Expand Down Expand Up @@ -199,9 +181,6 @@ children:
format: term
persistentItems: false
stretchFactor: 1
events:
change: './anovarm.events::onChange_postHocSupplier'
update: './anovarm.events::onUpdate_postHocSupplier'
children:
- type: TargetLayoutBox
label: ''
Expand Down Expand Up @@ -251,19 +230,13 @@ children:
populate: manual
persistentItems: true
stretchFactor: 1
events:
change: './anovarm.events::onChange_emMeansSupplier'
update: './anovarm.events::onUpdate_emMeansSupplier'
children:
- type: TargetLayoutBox
children:
- type: ListBox
name: emMeans
height: large
addButton: Add New Term
events:
listItemAdded: './anovarm.events::onEvent_emMeans_listItemsChanged'
listItemRemoved: './anovarm.events::onEvent_emMeans_listItemsChanged'
selectable: true
templateName: linreg-block-template
template:
Expand Down
20 changes: 10 additions & 10 deletions jamovi/js/ancova.events.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ const events = {
},

onUpdate_modelSupplier: function(ui) {
let variableList = this.cloneArray(ui.factors.value(), []);
let covariatesList = this.cloneArray(ui.covs.value(), []);
let variableList = this.clone(ui.factors.value(), []);
let covariatesList = this.clone(ui.covs.value(), []);

let combinedList = variableList.concat(covariatesList);

Expand Down Expand Up @@ -54,7 +54,7 @@ const events = {

let calcMarginalMeansSupplier = function(ui, context) {

let b1 = context.cloneArray(ui.factors.value(), []);
let b1 = context.clone(ui.factors.value(), []);
b1 = context.valuesToItems(b1, FormatDef.variable);

if (ui.emMeansSupplier)
Expand All @@ -68,8 +68,8 @@ let updateModelLabels = function(list, blockName) {
};

var calcModelTerms = function(ui, context) {
var variableList = context.cloneArray(ui.factors.value(), []);
var covariatesList = context.cloneArray(ui.covs.value(), []);
var variableList = context.clone(ui.factors.value(), []);
var covariatesList = context.clone(ui.covs.value(), []);

var combinedList = variableList.concat(covariatesList);

Expand All @@ -82,7 +82,7 @@ var calcModelTerms = function(ui, context) {
var diff2 = context.findChanges("covariatesList", covariatesList, true, FormatDef.variable);
var combinedDiff = context.findChanges("combinedList", combinedList, true, FormatDef.variable);

var termsList = context.cloneArray(ui.modelTerms.value(), []);
var termsList = context.clone(ui.modelTerms.value(), []);
var termsChanged = false;

for (var i = 0; i < combinedDiff.removed.length; i++) {
Expand Down Expand Up @@ -131,8 +131,8 @@ var calcModelTerms = function(ui, context) {
};

var updatePostHocSupplier = function(ui, context) {
var termsList = context.cloneArray(ui.modelTerms.value(), []);
var covariatesList = context.cloneArray(ui.covs.value(), []);
var termsList = context.clone(ui.modelTerms.value(), []);
var covariatesList = context.clone(ui.covs.value(), []);
var list = [];
for (var j = 0; j < termsList.length; j++) {
var term = termsList[j];
Expand All @@ -143,7 +143,7 @@ var updatePostHocSupplier = function(ui, context) {
};

var filterModelTerms = function(ui, context) {
var termsList = context.cloneArray(ui.modelTerms.value(), []);
var termsList = context.clone(ui.modelTerms.value(), []);
var diff = context.findChanges("termsList", termsList, true, FormatDef.term);

var changed = false;
Expand Down Expand Up @@ -172,7 +172,7 @@ var filterModelTerms = function(ui, context) {
};

var updateContrasts = function(ui, variableList, context) {
var currentList = context.cloneArray(ui.contrasts.value(), []);
var currentList = context.clone(ui.contrasts.value(), []);

var list3 = [];
for (let i = 0; i < variableList.length; i++) {
Expand Down
Loading

0 comments on commit 7f49a26

Please sign in to comment.