# Model Involving both Continuous and Categorical Variables using the ANCOVA?

Hello,

As I understand it, the Bayes Factor Package in R allows for mixed models with continuous and categorical variables using the lmBF function. What is the equivalent use in JASP? First I thought that the ANCOVA could capture this if one puts the categorical variables as fixed effects and the continuous variables as covariates. In the case I would have it as a repeated measures ANCOVA I could simply put Participant as the Random variable. And in the case I have repeated measures but no categorical variable I could simply use Random variable for Participant and the Covariate for my continuous variables. However, perpaps I am not correct in this interpretation? The use of ANCOVA can be confusing given the many, sometimes misleading, definitions in the literature.

Thanks in advance,

Philip

## Comments

Dear Philip,

You are correct in that you can specify the Bayesian ANCOVA in these two ways. I made two jasp files for you so you can see it for yourself. It all depends on how you have your data formatted. If your data is in the wide data-format, you can specify the RM ANCOVA with the actual RM ANCOVA menu in JASP. If you have data in the long format, and you don't feel like converting to wide, you can have a "workaround" for this by specifying the ID-column to be a random factor, and your timepoint-column to be a fixed factor. When comparing the two JASP files you can see that both output approximately the same results (there will always be a slight deviation, as mcmc-sampling is involved).

However, and like you said, this correspondence only holds when not including between subjects factors - if you do, the default model specifications (i.e., which interactions are used) will be different in JASP. Of course you can add the interactions manually (using the model drop-down menu) to again have these two approaches provide similar output.

Bottom line: it depends on whether you have your data in the long or wide format. Personally I prefer to stick to do Bayesian RM ANCOVA's using the actual RM ANCOVA menu in JASP, even if it means I have to reshape the data myself - it just feels a little bit less hacky

Kind regards,

Johnny

Thanks for the answer.

However, I am not sure it answered one of my concerns: if I have continuous variables as repeated measures, am I not better of using the BANCOVA? To be more specific: I have two variables, "Probability" and "Value": Each are continuous and have six levels each, and they are crossed to create 36 items. If I put it in the RM ANOVA (wide format) they will be treated as categorical? So is it not more proper to put them in the BANCOVA and then put "Participant" as Random?

Thus, I am not using the BANCOVA to "control" for continuous variables - as is often what one wants to do with the ANCOVA (if though this is essentially not proper...), I want to use the BANCOVA to essentially do something similar to a mixed regression involving both categorical and continuous predictors.

Thanks in advance,

Philip

Hi Philip,

If I understand correctly, you have two independent variables (probability and value) with six levels each, but are they measured between or within subjects? If you have your data in the wide format, with each column containing the observation of your dependent variable, per combination of the levels of your two factors, then running it in the RM ANOVA will result in them being treated categorically/nominally. This is the default setting in RM ANOVA, and is the same for, for instance, there are different time points. Time points can be considered to be continuous too, but because the ANOVA tests whether there is simply a different between time points, and not whether there is an effect over time, these are also treated as categories when computing a RM ANOVA.

Do you have a separate covariate, besides "probability" and "value", that you want to put in the model, or do you want to specify one of those two factors as a covariate? If you want you could share your dataset, or JASP-file, and I can take a further look. If you so desire you can also send it by email, to jbvandoorn uvanl

Cheers

Johnny

Hi again,

They are measured within subjects (WS), meaning they will be treated as categorical in the RM ANOVA. But I want them to be treated as continuous. Hence, I thought I could set it up with the ANCOVA instead?

So I have three variables, two of which are continuous and WAS, and one are categorical and between subjects (BS):

Probability (WS): .01, .20, .40, .60, .80, .99

Value (WS): $15, 30, 45, 60, 75, 90

Condition (BS): A, B, C.

Me and a colleague just ran both analyses in the Bayesian ANCOVA in JASP and with the lmBF function in the Bayes factor package and they produce the same results!