Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add_marginal fails due to identical name for interaction terms #76

Closed
olafdimigen opened this issue Oct 31, 2019 · 3 comments
Closed

add_marginal fails due to identical name for interaction terms #76

olafdimigen opened this issue Oct 31, 2019 · 3 comments

Comments

@olafdimigen
Copy link
Member

olafdimigen commented Oct 31, 2019

Here a minimal example for a bug encountered in uf_add_marginal. Reason for the bug is that cat * continuous interaction terms get the same predictor names in ufresult_avg.param.name for several different event types.

MODEL FORMULA:

cfgDesign.eventtypes  = {'Trialonset','Stimulus','Response'};
cfgDesign.formula     = {'y ~ 1', 'y ~ 1 + somecontinpredictor * cat(somecategoricalpredictor)', 'y ~ 1 + somecontinpredictor * cat(somecategoricalpredictor)'};

% where...
% somecontinpredictor is a contin. predictor
% somecategoricalpredictor has 3 levels

% model is solved successfully
% however, when calling

results = uf_addmarginal(results);

% uf_addmarginal crashes in line 164:
        
ufresultavg_ix(end+1) = find(strcmp(pOther{1},{ufresult_avg.param.name})); 

% The reason is that the assignment fails because the interaction terms for "Stimulus" and "Response" 
have the same name in "ufresult_avg.param.name" (**):

{'(Intercept)'                }
{'2_(Intercept)'              }
{'somecontinpredictor'             }
{'somecategoricalpredictor_5'               }
{'somecategoricalpredictor_6'               }
{'somecontinpredictor:somecategoricalpredictor_5'} % **
{'somecontinpredictor:somecategoricalpredictor_6'} % **
{'3_(Intercept)'              }
{'3_somecontinpredictor'           }
{'3_somecategoricalpredictor_5'             }
{'3_somecategoricalpredictor_6'             }
{'somecontinpredictor:somecategoricalpredictor_5'} % **
{'somecontinpredictor:somecategoricalpredictor_6'} % **``
@behinger
Copy link
Member

behinger commented Nov 1, 2019

Turns out there were two bugs, both in uf_designmat.

  1. Interactions were wrongly renamed
  2. Multi-level predictor interactions were added multiple times to EEG.unfold.variablenames, thus making the later renaming function fail.

Should work now

@behinger
Copy link
Member

behinger commented Nov 1, 2019

Commit: d6d9681

@behinger
Copy link
Member

is this fixed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants