{"action":"created","issue":{"url":"https://api.github.com/repos/paul-buerkner/brms/issues/66","repository_url":"https://api.github.com/repos/paul-buerkner/brms","labels_url":"https://api.github.com/repos/paul-buerkner/brms/issues/66/labels{/name}","comments_url":"https://api.github.com/repos/paul-buerkner/brms/issues/66/comments","events_url":"https://api.github.com/repos/paul-buerkner/brms/issues/66/events","html_url":"https://github.com/paul-buerkner/brms/issues/66","id":148765357,"number":66,"title":"Marginalising \"out\" a factor","user":{"login":"tomwallis","id":1918702,"avatar_url":"https://avatars.githubusercontent.com/u/1918702?v=3","gravatar_id":"","url":"https://api.github.com/users/tomwallis","html_url":"https://github.com/tomwallis","followers_url":"https://api.github.com/users/tomwallis/followers","following_url":"https://api.github.com/users/tomwallis/following{/other_user}","gists_url":"https://api.github.com/users/tomwallis/gists{/gist_id}","starred_url":"https://api.github.com/users/tomwallis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomwallis/subscriptions","organizations_url":"https://api.github.com/users/tomwallis/orgs","repos_url":"https://api.github.com/users/tomwallis/repos","events_url":"https://api.github.com/users/tomwallis/events{/privacy}","received_events_url":"https://api.github.com/users/tomwallis/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/paul-buerkner/brms/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-04-15T20:45:51Z","updated_at":"2016-05-02T09:56:58Z","closed_at":null,"body":"This is probably a more general question for R factor syntax, but if you have suggestions it would be appreciated.\r\n\r\nLet's say I have data with three factors: A and B both have two levels whereas C has four. I've fit a model using sum coding for the factors. Now I would like to plot the marginal estimates from the model for A and B (i.e. a two by two plot), *ignoring* or *marginalising out* factor C (rather than conditioning on only one level).\r\n\r\nThe `conditions` argument of `marginal_effects` allows me to specify the level I want to use for factor C... but shouldn't it be possible (because of sum coding) to just zero out the three coefficients associated with C, thus arriving at the grand mean (all other things being equal)?"},"comment":{"url":"https://api.github.com/repos/paul-buerkner/brms/issues/comments/216183808","html_url":"https://github.com/paul-buerkner/brms/issues/66#issuecomment-216183808","issue_url":"https://api.github.com/repos/paul-buerkner/brms/issues/66","id":216183808,"user":{"login":"tomwallis","id":1918702,"avatar_url":"https://avatars.githubusercontent.com/u/1918702?v=3","gravatar_id":"","url":"https://api.github.com/users/tomwallis","html_url":"https://github.com/tomwallis","followers_url":"https://api.github.com/users/tomwallis/followers","following_url":"https://api.github.com/users/tomwallis/following{/other_user}","gists_url":"https://api.github.com/users/tomwallis/gists{/gist_id}","starred_url":"https://api.github.com/users/tomwallis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomwallis/subscriptions","organizations_url":"https://api.github.com/users/tomwallis/orgs","repos_url":"https://api.github.com/users/tomwallis/repos","events_url":"https://api.github.com/users/tomwallis/events{/privacy}","received_events_url":"https://api.github.com/users/tomwallis/received_events","type":"User","site_admin":false},"created_at":"2016-05-02T09:56:58Z","updated_at":"2016-05-02T09:56:58Z","body":"To me, the case of marginalising out a factor as detailed above is the same logic as examining \"main effects\" in ANOVA. I can see your reasoning but I think this is probably case-specific: in many use cases it *could* make sense to marginalise out a factor in this way, rather than treating the factor as a random effect. In a two-by-two experimental design (two factors each with two levels), for example, we might be interested in testing not only whether there are simple effects (differences in the factor levels conditioning on each level of the other factor) but also main effects (differences in factor levels ignoring the other factor). \r\n\r\nAs a simple example from experimental psychology, consider the classic \"Stroop\" task, where I ask you to report the *colour* of the text a word is written in and I measure your response time to do so. The word can either be *congruent* (e.g. `GREEN` written in green letters) or *incongruent* (e.g. `GREEN` written in blue letters). The typical result is that you're faster in the congruent than the incongruent condition. Now imagine I include a second factor: whether you are performing only that single task, or whether I ask you to concurrently perform a second task (e.g. remember a telephone number). Imagine I expect an interaction, such that when you are acting in the dual-task condition I expect the difference between congruent and incongruent conditions to be even larger than in the single task condition. In this case, it would still be nice to be able to test or plot the main effect of congruent / incongruent, ignoring the task – which one could achieve by marginalising out the single / dual-task factor as described above. Note that it's not really useful to think of either of these conditions as random effects being sampled from a population of all possible conditions."}}