ANCOVA graphic?

Hello everyone,

I write my thesis and I am currently working on the data analysis. I did a factorial 2x2x2 ANOVA to test my main hypothesis. After that I included a covariate in the analysis and the effects on the dependent variable changed.

I want to show the effects of the factors BEFORE I controlled the influence of the covariate (the results from 2x2x2 ANOVA) and AFTER I controlled the covatiate (the resulta from ANCOVA). Is it possible to create a graphic on that?

Hi, @Miro.

I'm fairly confident that it's possible, given assignment of the before and after results to separate objects.

For example, the ggpubr package has short-cut anova plots. The single page documentation is pretty sketchy, but it seems well covered in a post

Likewise, ggplot2 has long been used to plot ancova objects, for example here

A great resource to look for examples is the custom pre-Google filtered for R search engine rseek.org.

Hi @Miro

Please see the FAQ: What's a reproducible example (`reprex`) and how do I do one? Using a reprex, complete with representative data will attract quicker and more answers. A question like this is very hard to answer in the abstract without reverse engineering the problem. Although that is sometimes possible it takes away from the time I spend volunteering (as much as I would like this to be paid, it isn't!) helping others.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

Mr. Richard Careaga, thank you for your response! I noticed that you left a comment on one of my previous posts, so I want to ask you something.

I would like, instead of ANCOVA to make a mixed ANOVA, therefor I need to switch to long data format (currently I am on ‚wide‘). My design is a 2x2x2x2 mixed ANOVA, as 3 factors are between- subjects and the last one is within-subjects.
I have many variables in my data frame (each item from my questionnaire is coded as variable).
When I try to do the data frame from wide to long data format using the command:
melt(data, id=c(„Faktor1“, „Faktor2“, „Faktor3“), measured=c(„Time1“, „Time2“))

it goes wrong – I get 5 columns (that is okay) but in the column “variable”, where the within variables are supposed to be, are all of the variables that I used to have in my initial data frame (incl. every item etc.). That's why and the scores in the last column („value“) are wrong.

I need to have the 5 variables (isolated) in long format to test my hypothesis with mixed ANOVA.
How do I manage to solve this, is there any way because I'm not sure where my mistake is.
Please, let me know if you have any question.

1 Like