# [R] Between subjects repeated measures ANOVA help. Level: Novice.

#### victorxstc

##### Pirate
So let me see I have understood well? You have 5 brands of implants. Apparently, you have bought one piece of implant only per each brand. Then you have tested the deformation of each implant under forces from 20 N to 120 N. Each load has been exerted for three times on a single point of each implant. You have assumed that after the first force was exerted, the implant does not undergo permanent deformation (or that the possible permanent deformation is trivial and ignorable)(right?). Then you have calculated the average of the three trials for each force per each implant and have considered the average deflection as your main response for the combination of that specific force and that specific implant.

Now your data consist of 5 implants x 11 force magnitudes (as the independent variables) and 55 values for deformation (as the dependent variable).

Please note that in this design., you have already combined the three repeated measures into one single value, and have already dropped the variance between those three measurements at each force-implant.

So I think we can run a multiple regression analysis (or a two-way ANOVA) to see if the increase in the force causes more deformation, if the changes in the implant type affect the deformation significantly, and if the effect of loading differs for each implant, or no its effect is similar for all the implant (interaction of implant x force)? After that, if the variable "brand" became significant, we can run a post hoc to see which couple of brands are responsible for the total significance observed in the whole dataset.

I hope I could help, but if there was something more, or I had not understood your design correctly, please give us more detail.

#### GretaGarbo

##### Human
Now the question is how many units did you have (the “n”) and how did random effect influence each other.

For each brand you just had one unit-of-investigation, one piece of metal? (We ignore that you had 2 sizes.) Is that true?

Did you take that piece of metal, “bumped it”(= put pressure on it) of 20N and then measured it? Then with the same metal piece you bumped it at 30N and measured it? Then you continued like that with the same piece of metal until you bump it at 120N, which you measured and the with the same piece of metal restarted with bumping at 20N and made measurement. The you continued the full cycle and after that made a third cycle? Is that how you did it?

OR, did you do it this way:

You took one piece bumped it at 20N, measured it, bumped it again at 20N and measured it, and did the same thing a third time? And then, with the same piece of metal bumped it at 30N and so on. Is that the way you did it?

I took it for granted that each measurement above represented one piece of metal each. So the estimates above are not valid.

I find all this very difficult!

#### pickle

##### New Member
So let me see I have understood well? You have 5 brands of implants. Apparently, you have bought one piece of implant only per each brand. Then you have tested the deformation of each implant under forces from 20 N to 120 N. Each load has been exerted for three times on a single point of each implant. You have assumed that after the first force was exerted, the implant does not undergo permanent deformation (or that the possible permanent deformation is trivial and ignorable)(right?).
That is right, the permanent deformation at such low force is not possible in these specimens.

Then you have calculated the average of the three trials for each force per each implant and have considered the average deflection as your main response for the combination of that specific force and that specific implant. Now your data consist of 5 implants x 11 force magnitudes (as the independent variables) and 55 values for deformation (as the dependent variable).
All correct!

Please note that in this design., you have already combined the three repeated measures into one single value, and have already dropped the variance between those three measurements at each force-implant.
Yes, those three repeated measures were not made at once, but in three repeated series from 20 N to 120 N.

So I think we can run a multiple regression analysis (or a two-way ANOVA) to see if the increase in the force causes more deformation, if the changes in the implant type affect the deformation significantly, and if the effect of loading differs for each implant, or no its effect is similar for all the implant (interaction of implant x force)?
I have already made the regression lines for each series of measurements and the increase in force caused more deformation, naturally, and a linear behaviour was noted. Yes, once again, you are right.

After that, if the variable "brand" became significant, we can run a post hoc to see which couple of brands are responsible for the total significance observed in the whole dataset.

I hope I could help, but if there was something more, or I had not understood your design correctly, please give us more detail.
Your understanding of my study design was flawless, and I am really pleasantly surprised that you have the will to help me.

#### pickle

##### New Member
Another question (from Greta): Did you do any measurement in between? Between "forces" and "hits"?
I did when I was testing the whole assembly for a few weeks, and gotten expected measurements (deformation showed a linear behaviour - the greater the force, the bigger the deformation). I have considered all that in between data as test data and have not recorded it due to the complex nature of deformation analysis.

And another one (again by Greta): Does the block material remain elastic under the maximum force you exerted (120 N force)? Or some permanent shape changes happen in the titanium material after the force reaches one of the loads you applied in your study?
There were no permanent changes in the titanium specimens, it remained elastic.

Last edited:

#### pickle

##### New Member
Now the question is how many units did you have (the “n”) and how did random effect influence each other.

For each brand you just had one unit-of-investigation, one piece of metal? (We ignore that you had 2 sizes.) Is that true?
That is true.

Did you take that piece of metal, “bumped it”(= put pressure on it) of 20N and then measured it? Then with the same metal piece you bumped it at 30N and measured it? Then you continued like that with the same piece of metal until you bump it at 120N, which you measured and the with the same piece of metal restarted with bumping at 20N and made measurement. The you continued the full cycle and after that made a third cycle? Is that how you did it?
Yes, I did it this way, my supervisor advised me that this would be better than repeating it in the same series.

I find all this very difficult!
I am really sorry to hear that, and thank you for wasting your time on helping me out, I appreciate it.

#### GretaGarbo

##### Human
Is there anybody who wants to do a stochastic specification for this one?

#### pickle

##### New Member
Does this mean that the anova that we used earlier in this thread is not applicable at all?

#### GretaGarbo

##### Human
Yes, as I said above the previous estimates are not valid. That was based on the assumption that there were 33 pieces of metal per brand. Now we have reached the conclusion that it was just one. Well, it has taken us 27 post to reach that, but science is advancing.

(And thereby avoided an incorrect conclusion.)

Isn't there something called something like Hook's law: that the deformation is proportional to the force? I thought that that was not applicable if there was destructive deformation (irreversible deformation). If that “law” is applicable it would put restriction on the model so that it is known that there is a linear regression model (and not only an anova) between deformation and force.

@Pickle, how would you do a stochastic specification for this project? For example for barnd1 when you are doing the second cycle of bumping 20N – 120N, and you are bumbing at 40N: How is that deformation measurement affected by the previous deformation at 30N? and by the before that at 20N? And at that still one previous at 120N? How do previous bumping affect the current measurement?

#### victorxstc

##### Pirate
@Pickle, how would you do a stochastic specification for this project? For example for barnd1 when you are doing the second cycle of bumping 20N – 120N, and you are bumbing at 40N: How is that deformation measurement affected by the previous deformation at 30N? and by the before that at 20N? And at that still one previous at 120N? How do previous bumping affect the current measurement?
Greta, I think pickle assumes (as he/she already confirmed) that the previous deformations are totally elastic, meaning that at these loads, absolutely no permanent deformations remain (or if there remains some ultra microscopical deformations, we can ignore them and consider them non-existent).

Pickle, I personally think your design is limited (like many other studies on expensive materials) but not invalid. You have still pairs of Force-Brand which can be used to predict the extent of deformation. Although as Greta said, it was better to exert each force-brand on a new piece of implant, it is not practically possible sometimes. So I think your design can be accepted.

Now I think your question is that "are your results valid"? I haven't read them yet, but I think why not? If you have used the correct test, and the assumptions of the test are met, why not? OK exerting 11 x 3 forces at a single point of each implant might be somehow limiting. If possible, I would rotate the implant at each trial, so that each new force would be exerted to a new point (of course if the implant design was symmetric, which I think it was). But even in your current design, as far as those forces did not bend the implant, or did not change the shape of the loading area (I mean the geometry of the small area at which the force is applied), it could be OK to load the same point frequently. I am not concerned with the former as you already told us that forces up to 120 N do not bend the implant permanently (to the plastic point) (even at microscopical level). But I am not sure whether titanium alloy is malleable or not under the forces up to 120 N.

Lets assume the worst scenario, that is distortion of the loading area by the applied forces. If the shape of the force bed changes after each try, you might have some noise in your results. But given your specific design in which the greater forces are applied after the smaller forces, you can be sure that at least in the first round of trials (from 20 N - 120 N), the changes in the loading area by the weaker forces could be ignorable when greater forces were applied. Because each force might tend to dig a microscopic shallow hole on the implant neck, and by increasing the force, that shallow hole will increase in size (IF implant is malleable of course, otherwise everything is fine).

So at least your results in the first round were likely reliable. If the 120 N of the first round distorted the loading area, the next 20 N force of the second round would be applied to a greater area, reducing the pressure exerted to the implant neck (in MegaPascal). So there might be some errors in the values obtained in the second and third rounds of loading.

That way, you can discard the two other rounds, instead of taking the average values. But you can also evaluate the second and third rounds, statistically. Check if there is a stable pattern of change (for example all decreasing) from the first trials to the second and from the second trials to the third?

You can use a repeated-measures ANOVA and its posthoc, or at least a paired t-test for this purpose. Put the results of all the implants in rows and differentiate them according to the number of the force application rounds (a table of 5 x 11 = 55 rows and 3 columns). Then using a t-test, check if there is a significant trend in the values in the first round compared to the second, and between the second and third rounds. If there were no significant changes between the three rounds of force application, it means that OK the error introduced into your design by ultra-microscopic deformations at each trial is not affecting your results (of course if your test power was sufficient [which I guess it would be, given the good sample size of yours]).

If the test showed that the second round of force application leads to deformations significantly lesser than the first round, and same happens in the third round, then I would suggest you to drop the second and third rounds of force application from your study.

However, you could still tend to use them and take the averages of the three trials of each Force-Brand. Using the second and third trials would of course introduce some measuring bias into your results (if there was a significant decrease in your deformations in the second and third trials). In particular, your Mean values would become affected (the mean would reduce or increase a little bit of course). But the correlations between the independent and dependent variables might still be valid. Although I do not recommend this option (even though I think the changes in the mean value would be really small, if detectable).

Otherwise, if there was no significant increases or decreases, all the three trials are likely valid and you can take their averages as the main value for the response of that specific Force-Brand. But as a suggestion, I think it would be better if you did not combine the three trials for each Force-Brand. That would lead to data loss. Although taking their average as your main result is quite good, it still omits their variance which is of course valuable. If you have the data pertaining to each round of force application [of course you have], I suggest you to use them as separate findings. That would give you a triple-sized sample with many more information.

I suggest you to report as well the results of the statistical assessment of the validity of the second and third trials in your thesis (and later, article) [and also here, if you wished].

#### GretaGarbo

##### Human
Now, he is talking!

What is charming with this site is that people can bring in not only their statistical knowledge, like Victor above, but also their biological knowledge. Thereby increasing the knowledge.

I am here because I hope for mutual learning. Not only that “Pickle” and the occasional reader will learn something. But also that applied statisticians from other areas, maybe psychometricians, can look and maybe gain, but most I hope that they will participate and bring in knowledge. Maybe methods that are of everyday use in their field but that is not applied that often in other areas. Most of all I hope that my prejudices and preconceived opinions will be challenged.

It seem to me like a great opportunity for say a biologist, to bring methods that are not well known in her field but are often use in say psychometrics. Just like when Wold brought in PLS, developed for sociometrics, into chemistry and essentially created chemometrics.

Many idea can be brought in into this field: shall we call it dentistometrics?

- - -

(It is just a pity that the above writer (vic) does not really understand objectivity! )

#### pickle

##### New Member
Dear Greta and Victorxstc, I am currently away on a business trip and will be back on Monday. I hope that we can continue this discussion when I arrive home, thank you once again.

#### pickle

##### New Member
Greta, I think pickle assumes (as he/she already confirmed) that the previous deformations are totally elastic, meaning that at these loads, absolutely no permanent deformations remain (or if there remains some ultra microscopical deformations, we can ignore them and consider them non-existent). Pickle, I personally think your design is limited (like many other studies on expensive materials) but not invalid. You have still pairs of Force-Brand which can be used to predict the extent of deformation. Although as Greta said, it was better to exert each force-brand on a new piece of implant, it is not practically possible sometimes. So I think your design can be accepted.
That is true. My study was funded from my own pocket so I could not have ideal conditions (even though I made an enormous effort to do everything by the book). Thank you for accepting my design.

Now I think your question is that "are your results valid"? I haven't read them yet, but I think why not? If you have used the correct test, and the assumptions of the test are met, why not? OK exerting 11 x 3 forces at a single point of each implant might be somehow limiting. If possible, I would rotate the implant at each trial, so that each new force would be exerted to a new point (of course if the implant design was symmetric, which I think it was). But even in your current design, as far as those forces did not bend the implant, or did not change the shape of the loading area (I mean the geometry of the small area at which the force is applied), it could be OK to load the same point frequently. I am not concerned with the former as you already told us that forces up to 120 N do not bend the implant permanently (to the plastic point) (even at microscopical level). But I am not sure whether titanium alloy is malleable or not under the forces up to 120 N.
Implants look like cylinders and they were rotated to a certain extent at each trial - only their position remained the same.

You can use a repeated-measures ANOVA and its posthoc, or at least a paired t-test for this purpose. Put the results of all the implants in rows and differentiate them according to the number of the force application rounds (a table of 5 x 11 = 55 rows and 3 columns). Then using a t-test, check if there is a significant trend in the values in the first round compared to the second, and between the second and third rounds. If there were no significant changes between the three rounds of force application, it means that OK the error introduced into your design by ultra-microscopic deformations at each trial is not affecting your results (of course if your test power was sufficient [which I guess it would be, given the good sample size of yours]).
The changes were within the method sensitivity error, so I believe that I could use the average values.

However, you could still tend to use them and take the averages of the three trials of each Force-Brand. Using the second and third trials would of course introduce some measuring bias into your results (if there was a significant decrease in your deformations in the second and third trials). In particular, your Mean values would become affected (the mean would reduce or increase a little bit of course). But the correlations between the independent and dependent variables might still be valid. Although I do not recommend this option (even though I think the changes in the mean value would be really small, if detectable).
My supervisor advised me to use the average values the other day. If I use the average values, then I suppose that Greta's advice on performing ANOVA remains valid and that I can use the ANOVA tables obtained using Greta's code?

I suggest you to report as well the results of the statistical assessment of the validity of the second and third trials in your thesis (and later, article) [and also here, if you wished].
I most certainly will inform you about everything that I am doing with this study. Thank you.

#### pickle

##### New Member
Dear Greta and Victorxstc,

could you help me with residuals? How do I analyse them in R?
Sorry for asking this many questions, but I am confused with those 4 graphs that I get (Residuals vs Fitted, Scale-Location, Normal Q-Q and Residuals vs Factor Levels).

#### victorxstc

##### Pirate
Hi pickle, hope your vacation went well!

Implants look like cylinders and they were rotated to a certain extent at each trial - only their position remained the same.
Ok then I think no other problems remain! No worries for affecting the loading point etc. by exerting the force at the same point.

The changes were within the method sensitivity error, so I believe that I could use the average values.
Nice!

My supervisor advised me to use the average values the other day. If I use the average values, then I suppose that Greta's advice on performing ANOVA remains valid and that I can use the ANOVA tables obtained using Greta's code?
Indeed. You can use an ANOVA as long as its assumptions are met. Many reports use average values between trials. As a matter of fact, the number of reports which use averages surpass by far those which use each data piece independently. So the method advised by your professor is totally fine, although the other method could be better.

I most certainly will inform you about everything that I am doing with this study. Thank you. Reply
Thanks.

could you help me with residuals? How do I analyse them in R?
Sorry for asking this many questions, but I am confused with those 4 graphs that I get (Residuals vs Fitted, Scale-Location, Normal Q-Q and Residuals vs Factor Levels).
You are so welcome. In your case, the normal distribution of residuals guarantees that you can use an ANOVA. In brief, a Q-Q plot with residuals aligned on the oblique straight line shows that your residuals are normally distributed. Although its interpretation is subjective, a straight alignment of residuals is usually obviously distinguishable. But I suggest you attaching your graphs here so that Greta can help you (she is not good with subjective tasks!).

#### pickle

##### New Member
Thank you for so much help.

This is one of my residuals analyses. The other two (I did 3 ANOVAs altogether, comparing brands among narrow diameter implants, comparing brands among wide diameter implants and comparing narrow and wide diameter implants) look almost the same.

#### victorxstc

##### Pirate
You are so welcome

Your graphs show that the residuals are well-behaved, their variance is constant, only a few outliers exist (which I think should not be removed from the model), their distribution is quite normal, and the leverage is similar for the observations.

So I guess you have a good sample to run the ANOVA!

#### GretaGarbo

##### Human
Hmm, well, eh,...
Although the graphs like fine, the above code that I gave is still not valid. That code was based on the assumption that there was 11 units per brand but there was just one (1).

@trinker and others:

When I asked above about where trinker saw a “repeated measurement layout” it was a real question about his interpretation of the design (and not a “confrontational” question). I thought that maybe he saw through what was going on and saw a repeated measures design or a random effect design.

Trinker suggested the “ez” R package and the book by Field. I or our library does not have access to that book. Does trinker or anybody else have any suggestions about documentation and examples of “ez” package?

I made an interpretation of the design that was a possible one, but it turned out to be an incorrect interpretation. Now it really looks like a repeated measures layout.

#### pickle

##### New Member
Any help on what I should do now?