Allometric effect

2,664 views
Skip to first unread message

marco....@gmail.com

unread,
Nov 30, 2016, 4:47:03 AM11/30/16
to geomorph R package
Dear all,

I have a question regarding allometric effect. I have a bunch of fish of the same species from different lakes, and I want to see if their shape change according to lake. The size of the fish changes from lake to lake, because in some of them there are only juveniles, has they have been introduced in the lakes recently.
I am faced with two options, either discarding the allometric effect by using the residuals of  Shape ~ log(Size), or use size (log centroid size) as a covariate.
Which approach is more correct or valid or reliable?

Thanks in advance for your help.

Marco

Mike Collyer

unread,
Nov 30, 2016, 8:09:38 AM11/30/16
to marco....@gmail.com, geomorph R package
Marco,

Using the residuals of shape regressed against log size for intergroup comparisons (using ANOVA) or performing ANOVA on shape with log size as a covariate should produce consistent results provided that in the latter, you add the covariate to a model first and use sequential (type 1) sums of squares and cross-products (which geomorph does).

The caveat is important because when using sequential SSCP, the lake effect would be estimated given that the size effect has already been estimated.  Also, keep in mind that the coefficients and SS in an ANOVA table will not be exactly the same with the two approaches, but should be comparable.  The reason for this is with the former approach, one estimates an intercept twice and in the latter, only once.

Finally, if performing the former approach, adding the mean shape to the residuals is a good idea.  This does not change any ANOVA results, but allows one to make TPS deformation grids for e.g., group means, which make sense with respect to the mean shape.

As a personal preference, I prefer using log(size) as a covariate in my analyses and comparing LS means.  I might use the residuals of shape regressed against log size before generating a plot of principal component scores, if visually comparing means is my intention.  (One could also do a between-group PCA.)  But the reason for using it as a covariate is that I can also have a log(size) * group interaction in my model, initially, to ascertain if I should even be comparing means in the first place.  (If significant, then comparing allometric trends is more appropriate.)

Hope this helps!
Mike

--
You received this message because you are subscribed to the Google Groups "geomorph R package" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geomorph-r-pack...@googlegroups.com.
To post to this group, send email to geomorph-...@googlegroups.com.
Visit this group at https://groups.google.com/group/geomorph-r-package.
To view this discussion on the web, visit https://groups.google.com/d/msgid/geomorph-r-package/6777f54d-d404-4441-8ca2-02dfed5ac672%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Message has been deleted

marco....@gmail.com

unread,
Nov 30, 2016, 9:26:10 AM11/30/16
to geomorph R package, marco....@gmail.com
Dear Mike,

Thanks for your reply, it was helpful, but I still have some issues, probably related to my lack of knowledge and understanding.
Here I report my results:

## I remove allometric effect and calculate pairwise between LS means

Shape <- arrayspecs(resid(lm(two.d.
array(coords)~size) + predict(lm(two.d.array(coords) ~ 1)), 16, 2)
lakes.pairwise <- advanced.procD.lm (Shape ~ Lake, ~1, groups = ~Lake, iter=9999, data= gdf.lakes)

Randomized Residual Permutation Procedure Used
10000 Permutations
ANOVA Table

       Df     SSE       SS       R2     F      Z Pr(>F)    
~1    371 0.21099                                          
~Lake 366 0.19333 0.017656 0.083683 6.685 6.0728  1e-04 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

## and P values

P-values
          Eck Glashan Lairage Lomond  Shira Tarsan
Eck     1e+00   1e-04  0.0001 0.0001 0.0001 0.0001
Glashan 1e-04   1e+00  0.0001 0.0001 0.0001 0.0001
Lairage 1e-04   1e-04  1.0000 0.0038 0.2611 0.0002
Lomond  1e-04   1e-04  0.0038 1.0000 0.0001 0.0152
Shira   1e-04   1e-04  0.2611 0.0001 1.0000 0.0001
Tarsan  1e-04   1e-04  0.0002 0.0152 0.0001 1.0000


### Using size as a covariate

lakes.pairwise2 <- advanced.procD.lm(Shape~log(size)+Lake,~log(size)*Lake,groups= ~Lake,slope=~log(size),iter=9999)

Randomized Residual Permutation Procedure Used
1000 Permutations
ANOVA Table
                                                          Df     SSE        SS       R2      F      Z Pr(>F)   
~log(size) + Lake                                         365 0.19149                                           
~log(size) + Lake + log(size):Lake                        360 0.18489 0.0066022 0.029151 2.5711 2.4903  0.001 **

## P-value from Contrasts in slope vector length
P-values
          Eck Glashan Lairage Lomond Shira Tarsan
Eck     1.000   0.090   0.506  0.615 0.213  0.804
Glashan 0.090   1.000   0.036  0.180 0.008  0.054
Lairage 0.506   0.036   1.000  0.317 0.760  0.683
Lomond  0.615   0.180   0.317  1.000 0.080  0.374
Shira   0.213   0.008   0.760  0.080 1.000  0.311
Tarsan  0.804   0.054   0.683  0.374 0.311  1.000

# P values from Angles between slope vectors

P-values
          Eck Glashan Lairage Lomond Shira Tarsan
Eck     1.000   0.010   0.075  0.081 0.010  0.001
Glashan 0.010   1.000   0.269  0.239 0.138  0.327
Lairage 0.075   0.269   1.000  0.655 0.530  0.119
Lomond  0.081   0.239   0.655  1.000 0.316  0.004
Shira   0.010   0.138   0.530  0.316 1.000  0.149
Tarsan  0.001   0.327   0.119  0.004 0.149  1.000


The results seems a bit different between the two approaches; I understand that when removing allometric effect I am comparing LS means, while in the second approach I compare the slope of the covariate. In the first approach most of my lakes differ in terms of mean shape, if I understood it correctly, but how do I correctly interpret the results of the second approach, when I use size as covariate? And do they suggest similar results to the first approach?

Thanks in advance

Marco



Mike Collyer

unread,
Nov 30, 2016, 9:34:17 AM11/30/16
to marco....@gmail.com, geomorph R package
Marco,

You did not do analogous approaches in both cases.  In the second case, you compared a model with heterogeneous slopes to one with a homogenous (common) allometric slope, so the pairwise comparisons made little sense (but actually, you were comparing slopes).  Change the second case to 

advanced.procD.lm(Shape ~ log(size) + Lake, ~ log(size), groups = ~Lake, slope = NULL, iter=9999)

and you should have analogous results.

NOW HAVING SAID THAT….

I recommend you stick with you second approach because as it demonstrates, you have heterogenous slopes.  There is no way to do an allometric correction, as you did in the first case, because the slopes are different.

You can also use procD.allometry to generate some helpful plots to understand how slopes might be different, but it looks like you have a combination of angular differences in allometric slopes between lakes (organisms change shape as they grow in different ways) and vector length differences (in some lakes, organisms change shape more as they grow).

YOU CANNOT COMPARE MEANS BECAUSE DIFFERENCES IN SHAPE ARE DIFFERENT AT SMALL AND LARGE SIZES.

As you alluded, having only juveniles in some cases means you really have to examine the different allometric patterns rather than try to merely adjust for them.

Good luck!
Mike

On Nov 30, 2016, at 9:23 AM, marco....@gmail.com wrote:

Dear Mike,

Thanks for your reply, it was helpful, but I still have some issues, probably related to my lack of knowledge and understanding.
Here I report my results:

## I remove allometric effect and calculate pairwise between LS means

Shape <- arrayspecs(resid(lm(two.d.array(coords)~size) + predict(lm(two.d.array(coords) ~ 1)), 16, 2)
The results seems a bit different between the two approaches; I understand that when removing allometric effect I am comparing LS means, while in the second approach I compare the slope of the covariate. In the first approach most of my lakes differ in terms of mean shape, if I understood it correctly, but how do I correctly interpret the results? And do they suggest similar results?

Marco


On Wednesday, November 30, 2016 at 1:09:38 PM UTC, Michael Collyer wrote:
Marco,

Using the residuals of shape regressed against log size for intergroup comparisons (using ANOVA) or performing ANOVA on shape with log size as a covariate should produce consistent results provided that in the latter, you add the covariate to a model first and use sequential (type 1) sums of squares and cross-products (which geomorph does).

The caveat is important because when using sequential SSCP, the lake effect would be estimated given that the size effect has already been estimated.  Also, keep in mind that the coefficients and SS in an ANOVA table will not be exactly the same with the two approaches, but should be comparable.  The reason for this is with the former approach, one estimates an intercept twice and in the latter, only once.

Finally, if performing the former approach, adding the mean shape to the residuals is a good idea.  This does not change any ANOVA results, but allows one to make TPS deformation grids for e.g., group means, which make sense with respect to the mean shape.

As a personal preference, I prefer using log(size) as a covariate in my analyses and comparing LS means.  I might use the residuals of shape regressed against log size before generating a plot of principal component scores, if visually comparing means is my intention.  (One could also do a between-group PCA.)  But the reason for using it as a covariate is that I can also have a log(size) * group interaction in my model, initially, to ascertain if I should even be comparing means in the first place.  (If significant, then comparing allometric trends is more appropriate.)

Hope this helps!
Mike
On Nov 30, 2016, at 4:47 AM, marco....@gmail.com wrote:

Dear all,

I have a question regarding allometric effect. I have a bunch of fish of the same species from different lakes, and I want to see if their shape change according to lake. The size of the fish changes from lake to lake, because in some of them there are only juveniles, has they have been introduced in the lakes recently. 
I am faced with two options, either discarding the allometric effect by using the residuals of  Shape ~ log(Size), or use size (log centroid size) as a covariate. 
Which approach is more correct or valid or reliable?

Thanks in advance for your help.

Marco

-- 
You received this message because you are subscribed to the Google Groups "geomorph R package" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geomorph-r-package+unsub...@googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups "geomorph R package" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geomorph-r-pack...@googlegroups.com.
To post to this group, send email to geomorph-...@googlegroups.com.
Visit this group at https://groups.google.com/group/geomorph-r-package.

marco....@gmail.com

unread,
Nov 30, 2016, 10:40:12 AM11/30/16
to geomorph R package, marco....@gmail.com
Mike,

I understand now, I wasn't too confident about removing size anyway, but from talking to other people in my lab I understood it is quite common to do.

Thanks for your help.

Marco
To unsubscribe from this group and stop receiving emails from it, send an email to geomorph-r-package+unsubscri...@googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups "geomorph R package" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geomorph-r-package+unsub...@googlegroups.com.
To post to this group, send email to geomorph-...@googlegroups.com.
Visit this group at https://groups.google.com/group/geomorph-r-package.

Mike Collyer

unread,
Nov 30, 2016, 11:39:38 AM11/30/16
to marco....@gmail.com, geomorph R package
You are welcome, Marco.

And yes, removing a common allometric effect is a common thing to do.  It is probably also commonly done when maybe it should not be done (that is, without verifying is one has heterogenous slopes before assuming a common allometry is acceptable).

Cheers!
Mike

To unsubscribe from this group and stop receiving emails from it, send an email to geomorph-r-pack...@googlegroups.com.

To post to this group, send email to geomorph-...@googlegroups.com.
Visit this group at https://groups.google.com/group/geomorph-r-package.

Sergio Ferreira Cardoso

unread,
Apr 5, 2017, 3:59:05 AM4/5/17
to geomorph R package

Dear Micharl and Marco,

I'm also trying to use residuals corrected for allometric effect but in fact the test for homogeinity of slopes rejected the hypotheses of parellel slopes, as you can see below.

Call:
procD
.allometry(f1 = shape ~ cs, f2 = ~species, logsz = TRUE,
    iter
= 499, RRPP = TRUE, print.progress = FALSE, data = gdf)



Homogeneity of Slopes Test

                 
Df     SSE       SS      R2     F      Z Pr(>F)
Common Allometry  72 0.24375
Group Allometries 66 0.21947 0.024281 0.03583 1.217 1.2839   0.01 *

---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 1

The null hypothesis of parallel slopes is rejected
  based on a signficance criteron of alpha
= 0.05

Based on the results of this test, the following ANOVA table is most appropriate

Type I (Sequential) Sums of Squares and Cross-products
Randomized Residual Permutation Procedure Used
500 Permutations

                 
Df      SS       MS     Rsq      F       Z Pr(>F)
log
(size)          1 0.14561 0.145613 0.21487 43.789 12.3948  0.002 **
species            
6 0.28830 0.048051 0.42544 14.450  6.6791  0.002 **
log
(size):species  6 0.02428 0.004047 0.03583  1.217  1.3039  0.006 **
Residuals         66 0.21947 0.003325
Total             79 0.67767

---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 1

So, apparently, in such cases, a size correction cannot be made. However, I found that in most works using Klingenberg's Morpho J, they use pooled within-group regression to obtain the size-corrected residuals. Apparently these method takes into account the different slopes of the different groups to calculate the residuals, which sounds good. What I'd like to know is if that method solves, in fact, this problem and also if it is possible to implement it with Geomorph.

Thank you in advance.

Best regards,
Sérgio Cardoso.

Mike Collyer

unread,
Apr 5, 2017, 6:53:24 AM4/5/17
to Sergio Ferreira Cardoso, geomorph R package
Sergio,

From what I can gather from the MorphoJ, the pooled within-group regression in MorphoJ is the same as doing the following with geomorph.

fit <- procD.lm(shape ~ group)
R <- fit$residuals
PWA <- procD.allometry(R ~ Csize)

In other words, residuals are first obtained by accounting for different group means.  This has the effect of removing differences in intercepts - not slopes - for different groups, which will make residuals smaller.  It does not in any way account for different intragroup allometric patterns.  In my reading of the MorphoJ user guide, it seems the motivation for doing this is to have group mean-correction so that one might visualize differences in slopes in plots with regression scores, rather than explicitly correcting for size in groups that have different allometries.  (The user guide makes mention that a common allometry and group allometries cannot be expected to be the same.  However, it does not explicitly warn against size correction with group structure, which I find unfortunate.)

Quite simply, whether encouraged by the MorphoJ user guide, or otherwise, users who use the pooled within-group regression in MorphoJ as a form of allometric correction and expect the results to somehow correct for different allometries are misguided.  Our position with procD.allometry is one should know whether allometries are unique of common, and can apply analyses appropriately.  

Emma Sherratt knows more about MorphoJ and can enlighten me and the group if I did not understand the intention of the pooled within-group regression.  I do not use MorphoJ, so my interpretation is based simply on the guide, and not any empirical evidence.

Mike

-- 
You received this message because you are subscribed to the Google Groups "geomorph R package" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geomorph-r-pack...@googlegroups.com.
To post to this group, send email to geomorph-...@googlegroups.com.
Visit this group at https://groups.google.com/group/geomorph-r-package.

Mike Collyer

unread,
Apr 5, 2017, 10:25:08 AM4/5/17
to Sergio Ferreira Cardoso, geomorph R package
Serio et al.

I have given my previous response some further consideration.  I wish to elaborate and point out some potential pitfalls.

In the MorphoJ user guide for regression, it states this:

"The bottom element is for selecting a pooled within-group regression. This type of regression is suitable, for instance, for removing the effect of within-group variation of a variable such as size, age or environmental factors before comparisons between groups. The analysis is performing a regression using the deviations of the dependent and independent variables from the respective group means (the group means are added back to the residuals and predicted values in the output dataset)."

This is rather precise and I can re-define how to do this in geomorph as follows:

fit.shape <- procD.lm(shape ~ group)
shapeR <- fit.shape$residuals
fit.size <- procD.lm(size ~ group)
sizeR <- fit.size$residuals
PWA <- procD.allometry(shapeR ~ sizeR, logsz = FALSE)

preds <- PWA$fitted.values + fit.shape$fitted.values
res <- PWA$residuals + fit.shape$residuals

NOTE: THIS ANALYSIS DOES NOT CORRECT FOR VARIED SLOPES!  It only corrects for different mean values for both independent and dependent variables.

But the guide also states this:

"If the dataset contains multiple groups, the question arises whether this group structure should be considered for size correction. In other words, the question is whether the correction should be specifically for the within-group allometric relationship or for the total allometry. This question does matter because the within- and between-group allometries cannot be expected to coincide in general.

If group structure is to be considered, size correction should be based on pooled within-group regression. This results in a reduction of shape variation within groups, which sometimes can lead to a substantial increase in the separation of groups."

NOTE: NOWHERE DOES THIS STATEMENT INDICATE THAT USING RESIDUALS FROM A POOLED WITHIN-GROUP REGRESSION WILL CORRECT FOR SEPARATE ALLOMETRIES.  It might be possible to read it this way, but that would be incorrect.  MorphoJ is simply indicating that pulling group means of shape and group means of size to the overall mean allows one to more easily compare group differences (separation) in allometry.

Finally, the manual states this:

"The regression analysis generates a new dataset that contains the residuals and predicted values as well as the regression scores for every observation in the analysis. This dataset can be used for further analyses. For instance, using the residuals from a regression of shape on centroid size is a method to correct for the effects of allometry.”

NOTE: CORRECTING FOR THE EFFECTS OF ALLOMETRY, IN THIS CASE FROM A SIMPLE LINEAR REGRESSION - AS IS STATED - MEANS SOMETHING TOTALLY DIFFERENT THAN “SIZE-CORRECTION”.  Size correction here is presented as correcting for groups having different average sizes when comparing allometric patterns.  That is not correcting for allometric variation!

Again, it is unfortunate that the guide does not expand upon this a bit.  I think people - if they are indeed using pooled within-group regression to remove the effects of multiple allometries - are accounting for a common allometry only, but haphazardly doing subsequent analyses as if they accounted for heterogeneity in allometric slopes, when they have not.  

I’ll reiterate this: you cannot remove heterogenous allometric variation but must address the separate allometric patterns when making comparisons among groups.  There is no comparing of means.  Wanting to do this and being able to do it are two different things.  The pooled within-group regression in MorphoJ does not confer this capability.  To believe it does is a misinterpretation of what the user guide says it actually does.

Cheers!
Mike

Adams, Dean [EEOBS]

unread,
Apr 5, 2017, 10:50:40 AM4/5/17
to Mike Collyer, Sergio Ferreira Cardoso, geomorph R package

All,

 

I have a few comments to share in this regard.  Pooled within-group approaches do not take into account differing slopes. In fact, they provide a misleading feeling that they are doing things correctly, when in this case they are absolutely not. Mike provided some cogent thoughts on this, but I’d like to re-iterate some in a different manner, as this is a common question and source of confusion to many.

 

First, if there is evidence of slope differences in mancova (as is found from the significant size:group interaction term in Sergio’s example in this thread), then the biological question of interest is how these slopes differ.  Are there large differences in how the allometries are oriented in shape space? Are some different but others not?  Are they statistically different in mancova but effectively oriented in the same direction? Etc. This is the type of pattern that one should be investigating once a significant size:group interaction has been identified, using tests of angles between allometry vectors etc. (see advanced.procD.lm). Note that this is the case even if the original intent of the test was to compare groups while accounting for allometry.  In other words, the data have changed the question from a comparison of group means to a comparison of group slopes.

 

Now, one might still insist on the group mean comparison, and try to identify a way to do so. But an important point is that when allometric trajectories are in fact different, there is no mathematical way to properly ‘correct’ for these and subsequently perform a group mean comparison using manova: all methods one can envision are in fact nonsensical. Specifically, residuals from any adjustment in these cases are incommensurate with one another across groups, and do not properly account for the allometry in those groups. A few example implementations illustrate why this is the case.

 

1: Say one decides to fit a common regression line to all groups, obtain residuals and do manova to compare groups.  Here all residuals are from a common regression model, so they represent the same thing relative to that model.  However, because the groups have different allometric slopes, this single, common slope model does not represent the actual allometry in any of the groups.  Thus, the residuals from the common model still contain part of the allometric effects in each group, and have are missing parts of non-allometric effects which were attributed to the predicted values. This occurs because the common allometry trajectory is oriented differently from the individual group allometries, so any residuals miss and gain parts of the shape variation through the procedure (draw on paper a bivariate regression line and a second line: add residual lines vertically and you will see what is ‘missed’ and ‘gained.’  So this method will not do what is intended.

 

2: Say one decides to do separate regressions for each group and obtain residuals for a comparison of groups. Here one has accounted for each species’ regression separately, so within species one has the ‘correct’ allometry-free residuals. But since the slopes of the groups are different the residuals from these separate regressions are not based on the same thing: they are residuals from different multivariate vectors [allometries] traversing shape space. Thus, any subsequent comparison of these is not useful, as the residuals across groups represent different things and are effectively apples and oranges.  So this method will not do what is intended.

 

3: Say one fits a common model using some pooled within-group covariance procedure, and obtains residuals from this for group comparisons. This approach is also flawed, because a pooled within-group model assumes that all within-group patterns are oriented in the same direction and of the same magnitude.  Yet the from test of slopes we know that this is not the case.  Thus, residuals from this procedure are not residuals from the actual allometric patterns: these residuals still contain some allometric effects within each species, and part of the non-allometric effects have been removed (as in example #1). So this method will not do what is intended.

 

In the end, regardless of which approach one uses, if the groups have differing allometric trajectories (as evidenced by the significant interaction and subsequent angle tests to confirm that the statistical effect is biologically meaningful), there is simply no reasonable way to obtain allometric residuals to compare the groups. Instead (like Mike recently stated), one must test for how the allometric slopes differ.  The data have changed your question from examining mean differences among groups to examining differences in group slopes.

 

Dean

 

Dr. Dean C. Adams

Professor

Department of Ecology, Evolution, and Organismal Biology

       Department of Statistics

Iowa State University

www.public.iastate.edu/~dcadams/

phone: 515-294-3834

 

From: geomorph-...@googlegroups.com [mailto:geomorph-...@googlegroups.com] On Behalf Of Mike Collyer
Sent: Wednesday, April 5, 2017 5:53 AM
To: Sergio Ferreira Cardoso <sff.c...@campus.fct.unl.pt>
Cc: geomorph R package <geomorph-...@googlegroups.com>
Subject: Re: [geomorph-r-package] Re: Allometric effect

 

Sergio,

 

From what I can gather from the MorphoJ, the pooled within-group regression in MorphoJ is the same as doing the following with geomorph.

 

fit <- procD.lm(shape ~ group)

R <- fit$residuals

PWA <- procD.allometry(R ~ Csize)

 

In other words, residuals are first obtained by accounting for different group means.  This has the effect of removing differences in intercepts - not slopes - for different groups, which will make residuals smaller.  It does not in any way account for different intragroup allometric patterns.  In my reading of the MorphoJ user guide, it seems the motivation for doing this is to have group mean-correction so that one might visualize differences in slopes in plots with regression scores, rather than explicitly correcting for size in groups that have different allometries.  (The user guide makes mention that a common allometry and group allometries cannot be expected to be the same.  However, it does not explicitly warn against size correction with group structure, which I find unfortunate.)

 

Quite simply, whether encouraged by the MorphoJ user guide, or otherwise, users who use the pooled within-group regression in MorphoJ as a form of allometric correction and expect the results to somehow correct for different allometries are misguided.  Our position with procD.allometry is one should know whether allometries are unique of common, and can apply analyses appropriately.  

 

Emma Sherratt knows more about MorphoJ and can enlighten me and the group if I did not understand the intention of the pooled within-group regression.  I do not use MorphoJ, so my interpretation is based simply on the guide, and not any empirical evidence.

 

Mike

On Apr 5, 2017, at 3:59 AM, Sergio Ferreira Cardoso <sff.c...@campus.fct.unl.pt> wrote:

 

https://lh3.googleusercontent.com/-_hFDUMh7Fuc/WOSjxH8ahkI/AAAAAAAAAsQ/z81IZeYl10k12xmWIpeBu1DxZ0a72yBzgCLcB/s320/prediction%2Blines.png

Sergio Ferreira Cardoso

unread,
Apr 5, 2017, 1:40:48 PM4/5/17
to geomorph R package
Hello Mike, Dean et al.,

First of all, thank you for your answers. I was a bit confused, but after going through your comments I understand I was doing a bad interpretation of the method. In fact, I just checked on an article (Kilingenberg, 2016) that has a discussion on this topic. In any way, I did as proposed and I went to check the angles between allometry vectors.
In fact, I tried to do a pairwise comparison between allometry vectors with advanced.procD.lm. No significant results are retrieved. There is no significant P-value for slope vector length nor for vector orientation (see below). So I'm having two contrasting results. Am I correct to say that the apparent heterogeinity of slopes between my species is not actually biologically meaningful? And if so, how can I explain these two results that point for an opposite direction in the final conclusion.

Thank you, once again.

Best,
Sérgio.


> advanced.procD.lm(shape ~ logcs, ~logcs+species,
+                   groups = ~species, slope = ~logcs, angle.type = "deg",
+                   iter = 199, data = gdf, print.progress = FALSE)

Call:
advanced
.procD.lm(f1 = shape ~ logcs, f2 = ~logcs + species,  
    groups
= ~species, slope = ~logcs, angle.type = "deg", iter = 199,      print.progress = FALSE, data = gdf)



Randomized Residual Permutation Procedure Used
200 Permutations
ANOVA
Table


                 
Df     SSE     SS      R2      F      Z Pr(>F)  
~logcs           78 0.53206                                       
~logcs + species 72 0.24375 0.2883 0.42544 14.193 6.2097  0.005 **

---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 1

##P-values for contrasts in slope vector lengths

P
-values
      cra   gig   jav   pen   tem   tet   tri
cra
1.000 0.745 0.585 0.465 0.760 0.705 0.865
gig
0.745 1.000 0.855 0.670 0.900 0.830 0.840
jav
0.585 0.855 1.000 0.765 0.760 0.740 0.950
pen
0.465 0.670 0.765 1.000 0.670 0.675 0.910
tem
0.760 0.900 0.760 0.670 1.000 0.755 0.970
tet
0.705 0.830 0.740 0.675 0.755 1.000 0.900
tri
0.865 0.840 0.950 0.910 0.970 0.900 1.000

##P-values for angles between slope values


P
-values
      cra   gig   jav   pen   tem   tet   tri
cra
1.000 0.635 0.535 0.805 0.655 0.760 0.615
gig
0.635 1.000 0.615 0.500 0.630 0.820 0.955
jav
0.535 0.615 1.000 0.535 0.730 0.655 0.750
pen
0.805 0.500 0.535 1.000 0.730 0.765 0.525
tem
0.655 0.630 0.730 0.730 1.000 0.695 0.845
tet
0.760 0.820 0.655 0.765 0.695 1.000 0.715
tri
0.615 0.955 0.750 0.525 0.845 0.715 1.000




quarta-feira, 30 de Novembro de 2016 às 10:47:03 UTC+1, marco....@gmail.com escreveu:

Sergio Ferreira Cardoso

unread,
Apr 6, 2017, 2:11:52 AM4/6/17
to geomorph R package
Mike,

Once again, thank you for clarifying my confusion around allometric effect and how to interpret group slopes. This discussion was very useful as well as all the other threads in the group.

Best,
Sérgio.


quarta-feira, 30 de Novembro de 2016 às 10:47:03 UTC+1, marco....@gmail.com escreveu:

Mike Collyer

unread,
Apr 6, 2017, 10:08:21 AM4/6/17
to geomorph R package
Sorry, everybody, I thought I had replied to everyone in the thread yesterday, but I only replied to Sérgio.  In case anyone is interested in my response, focusing on effect sizes and biological significance versus statistical significance, it is forwarded below.

Best,
Mike

Begin forwarded message:

From: Mike Collyer <mlco...@gmail.com>
Subject: Re: [geomorph-r-package] Re: Allometric effect
Date: April 5, 2017 at 1:52:54 PM EDT
To: Sergio Ferreira Cardoso <sff.c...@campus.fct.unl.pt>

Sérgio,

I would not say you had contrasting results.  Your interaction was significant; however, your R^2 for the common slope was 0.215 and for the unique slopes, 0.035.  As such, the effect size for the former was 12.4 sd and for the latter, 1.3 sd.  Your statistically significant effect is not biologically significant.  Thus, with 7 species, a bunch of really small differences compiled a small but significant overall effect.  These are not contrasting results, unless you use a P-value as a diagnostic tool, which many recommend never to do.

Dean mentioned this before, “… if the groups have differing allometric trajectories (as evidenced by the significant interaction and subsequent angle tests to confirm that the statistical effect is biologically meaningful)…”  OK, you had reason to believe based on your level 1 analysis that this was true, but the effect was small.  The level 2 analysis should convince you that the biological significance is not there.  If it were me, I would use these results as argument that a common allometry is okay, maybe get allometry-free residuals or shapes, and compare species means.

I hope everyone realizes that this process is important.  As Dean said, your data help to support which questions you should ask.  You learned that comparing allometries does not offer much; comparing species means while accounting for the large amount of shape-size covariation is probably what you want to do.

Hope that helps!
Mike


quarta-feira, 30 de Novembro de 2016 às 10:47:03 UTC+1, marco....@gmail.com escreveu:
Dear all,

I have a question regarding allometric effect. I have a bunch of fish of the same species from different lakes, and I want to see if their shape change according to lake. The size of the fish changes from lake to lake, because in some of them there are only juveniles, has they have been introduced in the lakes recently.
I am faced with two options, either discarding the allometric effect by using the residuals of  Shape ~ log(Size), or use size (log centroid size) as a covariate.
Which approach is more correct or valid or reliable?

Thanks in advance for your help.

Marco
--
You received this message because you are subscribed to the Google Groups "geomorph R package" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geomorph-r-pack...@googlegroups.com.
To post to this group, send email to geomorph-...@googlegroups.com.
Visit this group at https://groups.google.com/group/geomorph-r-package.

David Katz

unread,
May 18, 2017, 2:45:44 PM5/18/17
to geomorph R package
Hi everyone,

Sergio's advanced.procD call was this...

advanced.procD.lm(shape ~ logcs, ~logcs+species,
                   groups = ~species, slope = ~logcs, angle.type = "deg",
                   iter = 199, data = gdf, print.progress = FALSE)

I can kind of see what's going on, but would have thought the appropriate f1 and f2 models to check for slope homogeneity would be this...

advanced.procD.lm(shape ~ logcs+species, ~logcs*species,

                  groups = ~species, slope = ~logcs, angle.type = "deg",
                   iter = 199, data = gdf, print.progress = FALSE)

The two formulations produce the same estimates for slope vector length and slope correlations, so it's clear Sergio's version output taxon specific allometry vectors. However, the pairwise p-value and effect size matrices, and of course the ANOVA table, will differ (I checked this with a sample of my own). 

For which research questions would you prefer the first to the second formulation? Thanks.

David

Mike

To unsubscribe from this group and stop receiving emails from it, send an email to geomorph-r-package+unsub...@googlegroups.com.

Jeremy Gibson

unread,
Jul 7, 2017, 3:40:16 AM7/7/17
to geomorph R package

Hi everyone,


I am still quite new to morphometrics and I have done a couple of pilot studies investigating allometry effects of ear shape across populations and I greatly appreciate this thoughtful discussion across this thread. Being that I am new to morphometrics with no formal training, other than self-guided learning, I’m quite concerned that I too have been misinterpreting the results of these allometric / shape analyses. So I would like to ask the community if I am proceeding in the correct direction or if I should change my approach…

I’ve conducted a pilot study involving 2D data on ear shape for several different populations. My hypothesis is simply that ear shape differs by population. Here are some outputs I get from the Geomorph package in R.

 

procD.lm(f1 = Allometry$formula,iter = 499, RRPP = TRUE, data = Allometry$data) 
 
Type I (Sequential) Sums of Squares and Cross-products
Randomized Residual Permutation Procedure Used
500 Permutations
 
           Df       SS        MS      Rsq      F      Z Pr(>F)   
size        1 0.009615 0.0096148 0.041275 5.4245 4.1971  0.002 **
Residuals 126 0.223331 0.0017725                                 
Total     127 0.232945                                           
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
 
 
procD.allometry(f1 = coords ~ Csize, f2 = ~classifier$pop, logsz = FALSE, iter = 499, RRPP = TRUE, data = gdf) 

 

Homogeneity of Slopes Test

                   Df     SSE       SS       R2      F      Z Pr(>F)

Common Allometry  115 0.19045                                      

Group Allometries 104 0.17304 0.017402 0.074703 0.9508 1.0118   0.39

 

The null hypothesis of parallel slopes is supported

  based on a signficance criteron of alpha = 0.05

 

Based on the results of this test, the following ANOVA table is most appropriate

 

Type I (Sequential) Sums of Squares and Cross-products

Randomized Residual Permutation Procedure Used

500 Permutations

 

                Df       SS        MS      Rsq      F      Z Pr(>F)  

size             1 0.009615 0.0096148 0.041275 5.8059 4.1971  0.002 **

classifier$pop  11 0.032885 0.0029896 0.141172 1.8052 1.6674  0.002 **

Residuals      115 0.190445 0.0016560                                

Total          127 0.232945                                          

---

Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1



My original interpretation of these results was that size alone had a significant effect on the shape of the ear but when population is also included, as a grouping factor, there was an interaction between size and shape for each population. These results suggest that each population has a different shape due to an interaction with allometry. Is this a fair interpretation of these results?


So if I understand this correctly… My data, and the available analyses in geomorph, won’t allow me to say much about these shape differences by population other than to say that each population seems to have its own allometric patterns. This is because my data separates out into parallel slopes (as is the case in the above figure); is this correct? If these slopes were not parallel, this would indicate a similar allometric trajectory (for each population) which would suggest that any difference in shape is the result of size independent population effects; is this correct?


So strictly speaking my hypothesis would be supported, but this leads to questions regarding why are the allometries different?


I am currently planning to revisit this data but with the addition of another dimension (3D), and as I understand it, if I am on the right track I can essentially use the same approach but with the added dimension; is this correct? And if the parallel allometries appear again (which I anticipate they will since they are present in 2D) the interpretation would be the same.


Any insights would be helpful, thank you in advance for your time – Cheers.

Jeremy

Mike Collyer

unread,
Jul 7, 2017, 8:23:10 AM7/7/17
to Jeremy Gibson, geomorph R package
Hi Jeremy,

Your interpretation is close but not quite accurate.  You did not have a significant interaction between size and pop and the null hypothesis of parallel slopes is supported.  However, you have a significant pop effect, which means that at any given size, there is significant variation in shape among the pop levels.  Some would call this an “intercept test”, because as parallel lines never cross, it tests whether the points along the y-intercept differ.  But the intercept is a strange way to think of it, since there is not a case of no size.  A better way to think of it is that if you move along the size axis, some pop levels have consistently large PC scores and some have consistently lower PC scores, and the difference does not change as size changes.  (The PC scores change as size changes but the differences in PC scores stay the same.)

So, to summarize:
1) You have significant shape allometry.  Shape changes in a meaningful way as size increases, overall.
2) Each pop level has the same allometric pattern
3) However, at any size, there is variation in the different pop levels, meaning they differ in shape.  This shape difference persists along the size axis.

And for you understanding, a significant interaction would have revealed antiparallel allometries, meaning that shape changes in different ways with size for the different group levels.  In such cases, one cannot say “pop levels differ in shape”, as the need to qualify size would be important.  Because your allometries were parallel, it is easier to speak about shape differences without having to concern yourself with at which size you are speaking about shape differences.

Hope that helps!
Mike

--
You received this message because you are subscribed to the Google Groups "geomorph R package" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geomorph-r-pack...@googlegroups.com.

To post to this group, send email to geomorph-...@googlegroups.com.
Visit this group at https://groups.google.com/group/geomorph-r-package.

Jeremy Gibson

unread,
Jul 7, 2017, 10:28:05 AM7/7/17
to geomorph R package, jeremy....@gmail.com
Michael,

Thank you so much for your quick and detailed reply! 

We have a significant population effect on ear shape regardless of allometry. Well then, this is better than I originally thought. I think my confusion stems from the significant result of size alone from the first procD.lm function and when population was added, both population and size were significant. 

To be sure I understand what's going on here I have follow up questions: for populations that have the same slope and intercept, causing them to overlap in PCA space; does this mean they share a common (or the same) relationship between allometry and shape? This relationship appears in my data for some of the populations (in the figure above). Effectively if this is the case than regardless if one animal is exceptionally small and the other is exceptionally big, the shape of their ear is affected by allometry in the same way. Is this a correct interpretation?

Thank you so much for you time and thoughtful responses.
Cheers,
Jeremy
To unsubscribe from this group and stop receiving emails from it, send an email to geomorph-r-package+unsub...@googlegroups.com.

Mike Collyer

unread,
Jul 7, 2017, 11:04:09 AM7/7/17
to Jeremy Gibson, geomorph R package
Jeremy,

1) All of your populations have the same relationship between shape and size (allometry).  There is no relationship between shape and allometry; that is like saying there is a relationship between shape and shape and size.  Allometry is the relationship.
2) Doing an analysis for shape differences without size, knowing that there is significant allometry, would be dangerous, because you run the risk of inferring shape differences as a result of size differences.  Simply do not do this.  Keep size as a covariate.
3) In the plot, if the lines appear close to each other, those populations do not differ much in shape at any given size.  If the lines are far apart, those populations differ more in shape at any given size.
4) Yes, whether an animal is small or large, the allometric pattern is the same.  You can somewhat predict how shape will change for a small animal in one population and know, compared to a large animal in a different population, if their shapes would be similar or not, based on the spacing of those lines.  This is why understanding the allometry is important.

Best,
Mike

To unsubscribe from this group and stop receiving emails from it, send an email to geomorph-r-pack...@googlegroups.com.

To post to this group, send email to geomorph-...@googlegroups.com.
Visit this group at https://groups.google.com/group/geomorph-r-package.

Jeremy Gibson

unread,
Jul 7, 2017, 11:56:33 AM7/7/17
to geomorph R package, jeremy....@gmail.com
MIke,

Fab! Thanks again for your useful comments, I very much appreciate the insights. I definitely will be asking more questions as I get deeper into my data, data analysis and interpretation.

Cheers,
Jeremy
To unsubscribe from this group and stop receiving emails from it, send an email to geomorph-r-package+unsubscri...@googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups "geomorph R package" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geomorph-r-package+unsub...@googlegroups.com.
To post to this group, send email to geomorph-...@googlegroups.com.
Visit this group at https://groups.google.com/group/geomorph-r-package.

Sergio Ferreira Cardoso

unread,
Sep 19, 2017, 5:14:53 AM9/19/17
to geomorph R package
Dear all,

I came back to this topic for 2 reasons. The first and most important is that there is a rather strange result when I perform a PCA on my procD.allometry residuals. Here is what I did:


> gdfALLOMETRY <- geomorph.data.frame(shape = pilosa.gpa$coords, cs = pilosa.gpa$Csize, gp = a$sp)
> pilosaAllometry <- procD.allometry(shape~cs, ~gp, logsz = TRUE, data=gdfALLOMETRY, iter=999, print.progress = FALSE)

Homogeneity of Slopes Test

Allometry Model
> summary(pilosaAllometry)

Call:
procD
.allometry(f1 = shape ~ cs, f2 = ~gp, logsz = TRUE, iter = 999,      print.progress = FALSE, data = gdfALLOMETRY)



Homogeneity of Slopes Test
                   
Df     SSE       SS       R2      F        Z Pr(>F)
Common Allometry  159 0.55177                                         
Group Allometries 153 0.52378 0.027985 0.020186 1.3624 -0.56748 0.7155


The null hypothesis of parallel slopes is
 supported
  based on a significance criterion of alpha
= 0.05

Based on the results of this test, the following ANOVA table is most appropriate

Type I (Sequential) Sums of Squares and Cross-products
Randomized Residual Permutation Procedure Used
1000 Permutations


           
Df      SS      MS     Rsq      F       Z Pr(>F)
   
log
(size)   1 0.24828 0.24829 0.17909 71.547  9.3804  0.001 **
gp          
6 0.58632 0.09772 0.42292 28.159 17.6800  0.001 **
Residuals 159 0.55177 0.00347                                
Total     166 1.38637                                        
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 1
> pilosaAnova <- procD.lm(pilosaAllometry$formula, data = pilosaAllometry$data, iter = 999, RRPP=TRUE, print.progress = FALSE)
> shape.resid <- arrayspecs(pilosaAnova$residuals, p=dim(pilosa.gpa$coords)[1], k=dim(pilosa.gpa$coords)[2])
> #Allometry-free shapes
> adj.shape <- shape.resid + array(pilosa.gpa$consensus, dim(shape.resid))
> PCA_allo <- plotTangentSpace(adj.shape, axis1 = 1, axis2 = 2, groups = gp, legend = FALSE)

I get this PCA (colors are different species; PC1 9.7%, PC2 7.5% ). However, if I don't add a f2 formula (in this case ~gp) I get a distribution of the points in the morphospace that makes biological sense (PC1 21.5%, PC2 20%). For me it makes sense to add species (~gp) as a variable, instead of just size. Does anyone have a clue about what might be happening in this situation? Can this have any special meaning regarding my data?




 A second thing is that I believe there might be a bug in the procD.allometry function, since it appears to always try to do a log transformation on the size variable, even when I ask it not to (logz=FALSE).
model <- procD.allometry(shapeR~sizeR, logsz = FALSE, data=gdfmodel, iter=999, print.progress = FALSE)
Error in procD.allometry(shapeR ~ sizeR, logsz = FALSE, data = gdfmodel,  :
 
Size cannot be negative if using log-transformation



Thank you, once again.

Best regards,
Sérgio.

Mike Collyer

unread,
Sep 19, 2017, 6:37:29 AM9/19/17
to geomorph R package
Sérgio,

You have removed a common allometric effect AND SPECIES effects from your shapes and then were surprised that the PC plot did not reveal species differences.  Your allometry analysis revealed that species have a common allometry but also impressively large species differences in shape, given this common allometry; i.e., the intercepts for the species are quite varied.  The differences between the PC plots and their explained variation along axes emphasizes that in one case you removed species effects and in the other you didn’t.  In the latter, the first PC accounts for more variation because there are inherently large differences in shape among species.  If your intent is to visualize species differences with a PC plot, you should not have ~gp in the formula to remove the common allometry, or you should perform a PCA on the fitted values rather than the residuals.

Regarding the bug you think you found, I admit that it is a misleading error message.  The error is because you have negative size values.  The error message assumes that this happened because of transformation rather than you actually using a size variable that has negative values.  We will have to update the error message, but the error is simply because we have a trap for any negative values for size.  This is not a bug.  Size cannot be negative.

Cheers,
Mike


--
You received this message because you are subscribed to the Google Groups "geomorph R package" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geomorph-r-pack...@googlegroups.com.

To post to this group, send email to geomorph-...@googlegroups.com.
Visit this group at https://groups.google.com/group/geomorph-r-package.

Igor Talijančić

unread,
Nov 14, 2018, 8:43:59 AM11/14/18
to geomorph R package

Hello everyone,

The discussion on this topic was very useful and I would like to say thanks to all of you for clearing the concepts of allometry more briefly to everyone. I have just a few questions regarding the results I have obtained that am not so sure if I am interpreting them correctly. I have four groups of fish from different geographic locations and I wanted to inspect their allometric patterns as well as to check the HOS test in order to justify the inclusion of allometry – free shape residuals in further analysis. The obtained results are:

 

procD.allometry(f1 = shape ~ logcs, f2 = ~group, iter = 999, data = gdf)

 

 

Homogeneity of Slopes Test

                  ResDf     RSS       SS        MS      Rsq      F      Z     P Pr(>F)

Common Allometry    934 0.42744                                                      

Group Allometries   931 0.41227 0.015177 0.0050588 0.032153 11.424 8.6771 0.001      

Total               938 0.47201                                                    938

 

The null hypothesis of parallel slopes is supported

  based on a significance criterion of alpha = 0.05

 

Based on the results of this test, the following ANOVA table is most appropriate

 

Type I (Sequential) Sums of Squares and Cross-products

Randomized Residual Permutation Procedure Used

1000 Permutations

ANOVA effect sizes and P-values based on empirical F distributions

 

 

           Df      SS        MS     Rsq      F      Z Pr(>F)  

log(size)   1 0.02476 0.0247627 0.05246 54.109 8.3210  0.001 **

group       3 0.01981 0.0066032 0.04197 14.429 9.0735  0.001 **

Residuals 934 0.42744 0.0004576 0.90557                       

Total     938 0.47201                                         

---

Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

 

allometry_groups.png



The results showed no significant interaction between size and group and the null hypothesis of parallel slopes is supported, as stated by the HOS test and shown with the plot. This justifies the inclusion of allometry – free shape residuals in further analysis.

However, the obtained P value is 0.001 and the HOS test is still stating that the null hypothesis is supported. I don’t know if I am missing something, but if p value is < 0.05, shouldn’t the null hypothesis be rejected?

They also displayed that a group effect is significant, meaning that at any given size, there is a significant variation in shape among group levels. Or more specifically the results display significant shape allometry where each group level has the same allometric pattern but there is a shape variation in the different group level. When looking at the plot, groups 2-3-4 do not differ much in shape at any given size, but group 1 is more apart from them meaning they differ more in shape at any given size. When observing the direction of the parallel lines can it be stated that there is significant amount of shape change per unit of size change going on. For instance, if those allometric vectors were parallel with the size axis then the amount of shape change would be negligible per unit of size change.  Is this reasoning good or not on the right track?

 

Thank you for your time and consideration.

 

Sincerely,

Igor

Adams, Dean [EEOBS]

unread,
Nov 14, 2018, 3:50:25 PM11/14/18
to geomorph-...@googlegroups.com

Igor,

 

Try installing the latest version of geomorph and running again. There was a bug some time ago in that toggle, which has been fixed.

 

Note: I just ran the example from the help file of geomorph version 3.0.7, and confirmed that when the group allometry term is significant, it does provide the full model containing the interaction term.


Dean

 

Dr. Dean C. Adams

Director of Graduate Education, EEB Program

Professor

Department of Ecology, Evolution, and Organismal Biology

Iowa State University

www.public.iastate.edu/~dcadams/

phone: 515-294-3834

--

You received this message because you are subscribed to the Google Groups "geomorph R package" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geomorph-r-pack...@googlegroups.com.
To post to this group, send email to geomorph-...@googlegroups.com.
Visit this group at https://groups.google.com/group/geomorph-r-package.

Igor Talijančić

unread,
Nov 15, 2018, 6:03:21 AM11/15/18
to geomorph R package

Dear Dr. Adams,

 

I have done steps according to your suggestion and still got the same results as I previously displayed where the P (Pr > F) is still 0.001 but the model states: “The null hypothesis of parallel slopes is supported based on significance criterion of alpha = 0.05”. The interaction term isn’t displayed in the ANOVA table.

 

Is this still a bug, or am I getting some results that aren’t meaningful? If there are correct, wouldn’t the result p value indicate that the model should be rejected? But when you look at the plot the slopes are parallel so I don’t know what to think or how to report the results regarding allometry.

 

 

Thank you for your given time and consideration.

 

 

Sincerely,

Igor

To unsubscribe from this group and stop receiving emails from it, send an email to geomorph-r-package+unsub...@googlegroups.com.
To post to this group, send email to geomorph...@googlegroups.com.

Mike Collyer

unread,
Nov 15, 2018, 6:27:30 AM11/15/18
to geomorph R package
Igor,

Did you install from CRAN instead of Github?  We make immediate updates to Github; CRAN requires waiting some time before submitting new versions.  We can be more responsive on Github.

Try the following:

devtools::install_github(“geomorphR/geomorph”, ref = “Stable”)

This requires having the package, devtools, installed.

Best,
Mike

To unsubscribe from this group and stop receiving emails from it, send an email to geomorph-r-pack...@googlegroups.com.
To post to this group, send email to geomorph-...@googlegroups.com.

Igor Talijančić

unread,
Nov 15, 2018, 9:20:23 AM11/15/18
to geomorph R package
Dear Michael,

I have downloaded from the Github and the analysis showed now that the null hypothesis is now rejected but the interaction term isn't displayed. I have also noted that there isn't a significant code displayed at the p value at the at HOS test.  


Call:
procD.allometry(f1 = shape ~ logcs, f2 = ~group, iter = 999,      data = gdf) 



Homogeneity of Slopes Test
                  ResDf     RSS       SS        MS      Rsq      F      Z     P Pr(>F)
Common Allometry    934 0.42744                                                       
Group Allometries   931 0.41227 0.015177 0.0050588 0.032153 11.424 8.6771 0.001       
Total               938 0.47201                                                    938

The null hypothesis of parallel slopes is rejected
  based on a significance criterion of alpha = 0.05 

Based on the results of this test, the following ANOVA table is most appropriate

Type I (Sequential) Sums of Squares and Cross-products
Randomized Residual Permutation Procedure Used
1000 Permutations
ANOVA effect sizes and P-values based on empirical F distributions


           Df      SS        MS     Rsq      F      Z Pr(>F)   
log(size)   1 0.02476 0.0247627 0.05246 54.109 8.3210  0.001 **
group       3 0.01981 0.0066032 0.04197 14.429 9.0735  0.001 **
Residuals 934 0.42744 0.0004576 0.90557                        
Total     938 0.47201                                          
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1


Sincerely,
Igor
Mike

To unsubscribe from this group and stop receiving emails from it, send an email to geomorph-r-package+unsubscri...@googlegroups.com.


-- 
You received this message because you are subscribed to the Google Groups "geomorph R package" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geomorph-r-package+unsub...@googlegroups.com.

Mike Collyer

unread,
Nov 16, 2018, 8:23:07 AM11/16/18
to geomorph R package
Igor,

It looks like in our last update, we reverted to the previous problem.  I have again updated this.  If you install from Github, it should work now.

Sorry for the inconvenience.

Best,
Mike


To unsubscribe from this group and stop receiving emails from it, send an email to geomorph-r-pack...@googlegroups.com.

To post to this group, send email to geomorph-...@googlegroups.com.
Visit this group at https://groups.google.com/group/geomorph-r-package.

Igor Talijančić

unread,
Nov 18, 2018, 8:08:59 AM11/18/18
to geomorph R package
Michael,

everythink works now fine. Thank you so much for your time and effort!


Sincerely,
Igor
Igor,

To unsubscribe from this group and stop receiving emails from it, send an email to geomorph-r-package+unsub...@googlegroups.com.

To post to this group, send email to geomorph-...@googlegroups.com.
Visit this group at https://groups.google.com/group/geomorph-r-package.

Sergio Ferreira Cardoso

unread,
Dec 26, 2018, 8:48:07 AM12/26/18
to geomorph R package
Dear Michael,

I updated Geomorph in R and I'm performing homogeneity of slopes tests but this time I'm getting an error message. I came back to an old dataset with which I had worked at the time, and I still get this error message. Before the analysis was performed without any problem. Here is what I'm doing (and always did).

Thanks in advance.

HOS<-advanced.procD.lm(shape ~ log(cs)+gp, ~log(cs)*gp, groups = ~gp, slope = ~log(cs), angle.type = "deg", iter = 9999, data = gdf, print.progress = FALSE)

Warning: Because variables in the linear model are redundant,
the linear model design has been truncated (via QR decomposition).
Original X columns: 12
Final X columns (rank): 11
Check coefficients or degrees of freedom in ANOVA to see changes.

Error in pairwise(pfitF, fit.null = pfitR, groups = gp, covariate = covariate,  : 
  The groups factor does not have replication at each level.

Igor,

To unsubscribe from this group and stop receiving emails from it, send an email to geomorph-r-package+unsub...@googlegroups.com.

To post to this group, send email to geomorph-...@googlegroups.com.
Visit this group at https://groups.google.com/group/geomorph-r-package.

Mike Collyer

unread,
Dec 26, 2018, 10:01:08 AM12/26/18
to geomorph R package
Sérgio,

There might be a difference between a function working and an analysis working, as it should.  The error you are experiencing is because your group factor has more levels than it should.  You analysis should not estimate a mean or slope for a group that does not occur in your data, so the function should not work.  This update occurred recently, and we might have had code in older versions that fixed issues like extra factor levels for the user, without knowledge that it happened.  These warning and error messages arise from RRPP functions, which advanced.procD.lm now depends.  (That package tends to reveal errors rather than attempt to avert them.)

Here is the problem in a nutshell.  Let’s make a factor, say for three species, and subsequently remove one of the species from our data:

> myFactor <- factor(rep(c("a","b","c"), each = 4))
> myFactor
 [1] a a a a b b b b c c c c
Levels: a b c
> newFactor <- myFactor[1:8]
> newFactor
[1] a a a a b b b b
Levels: a b c

Notice that although we subsetted our data, our new Factor still expects that level c could occur in our data.  Any linear model design matrix with this factor will not be full rank.  This can be fixed with droplevels; i.e.,

> newFactor <- droplevels(newFactor)
> newFactor
[1] a a a a b b b b
Levels: a b

You could do the same with your data, with 

gdf$gp <- droplevels(gdf$gp)

I checked our old coding, before our dependency on RRPP, and it would have inherently dropped extra factor levels, although it was not the intention.  Because circumventing data issues like this can have unintended consequences in other places, I am loath to update the current function to bypass inappropriate factors.  As a philosophy, I would rather have data configuration issues resolved in setting up the data frame rather than in the analysis.

I recommend using droplevels first, but if that does not resolve the issue, please let us know, maybe sending your script and data.

Best,
Mike


To unsubscribe from this group and stop receiving emails from it, send an email to geomorph-r-pack...@googlegroups.com.

To post to this group, send email to geomorph-...@googlegroups.com.
Visit this group at https://groups.google.com/group/geomorph-r-package.

Igor Talijančić

unread,
Feb 5, 2019, 4:28:06 AM2/5/19
to geomorph R package

Dear all,

I have a question that is puzzling me some time now regarding allometry, specifically homogeneity of slopes test (HOS) and phenotypic trajectory analysis (PTA) and I hope someone can shed light on this topic.

In my case, I have fish population that dwell in habitats that are rich and poor in food resources and I want to statistically evaluate the variance and covariance of variables associated with the population-environment interaction. HOS test rejected the hypothesis of parallel slopes so I applied advanded.procD.lm function in order to see if one or more populations undergo more shape change per unit centroid size that others,  do they develop at the same rate but undergo different changes in shape or do they display the combination of angular differences in allometric slopes and vector length differences.

Few populations displayed combination of angular differences in allometric slopes and vector length differences, meaning that they have different allometric trajectories. Because of that there is no reasonable way to obtain allometric residuals to compare the groups, so does that mean that I have to add centroid size as a covariate in the PTA analysis? If so, don’t HOS and PTA display kind of the same thing? To my best understanding, both approaches can be used to establish patterns of direction and magnitude of shape change with size by testing for differences in slope angle and length, but they visualise different aspects of the results where HOS visualise them in size-shape space and PTA in morphospace.

 

Thank you for your given time and effort.

Adams, Dean [EEOBS]

unread,
Feb 5, 2019, 9:10:20 AM2/5/19
to geomorph-...@googlegroups.com

Igor,

 

Please see the help file for trajectory.analysis. This function allows one to include additional covariates using the ‘f2’ argument.

 

Dean

 

Dr. Dean C. Adams

Director of Graduate Education, EEB Program

Professor

Department of Ecology, Evolution, and Organismal Biology

Iowa State University

phone: 515-294-3834

 

From: geomorph-...@googlegroups.com <geomorph-...@googlegroups.com> On Behalf Of Igor Talijancic
Sent: Tuesday, February 5, 2019 3:28 AM
To: geomorph R package <geomorph-...@googlegroups.com>
Subject: [geomorph-r-package] Re: Allometric effect

 

Dear all,

--

You received this message because you are subscribed to the Google Groups "geomorph R package" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geomorph-r-pack...@googlegroups.com.
To post to this group, send email to geomorph-...@googlegroups.com.
Visit this group at https://groups.google.com/group/geomorph-r-package.

Message has been deleted

Maddy Lang

unread,
Mar 23, 2023, 1:14:26 PM3/23/23
to geomorph R package
Hello, 

I have been investigating allometric patterns in endocranial shape within Euarchontoglires and have found this thread to be fantastically helpful. Nevertheless, I am having trouble interpreting some of my results. Essentially, my HOS test indicates that there may be differences in allometric scaling patterns across major clades (Rsq = 0.033, p = 0.011). However, my post hoc tests failed to identify significant differences among any of these groups. I believe Sergio had a similar result and given that there appeared to be no biological significance to the differences identified in the HOV test (as determined from the level 2 analysis) it was acceptable to perform subsequent analyses  with common allometric corrections. While my results seem to lead to the same conclusion, I am worried that using common allometry is not appropriate based on the RegScore and PredLine plots (below). 

In the PredLine plot (fig. 1), it is very obvious that these clades have different (and non-parallel) allometric trajectories, and so, I was very surprised that the pairwise tests did not identify any differences. In the RegScore plot (fig. 2), it appears that there is no overlap in shape for species of the same size between Primates (pink and purple) and all other groups and therefore using common allometry would not be appropriate as the size/shape relationships between these clades are distinct. 

Either I am misinterpreting the plots below and ascribing them too much significance when I should be focusing on the statistical results, I am misinterpreting my statistical results, or I have implemented these tests incorrectly. Though I don't think this later point is the case (I ran the same test with slightly different code published by Marcy et al., 2020 and had the same results), I have provided an expert of my code below the plots. I have also seen some discussion of assessment of angles and vector lengths using the advanced.procD.lm function which has been depreciated. Would these tests be worth performing? 

Best, 

Madlen

Figure 1. Fitted values of PC1 plotted against Csize (predictor).

Figure 2. Regression scores of endocranial shape plotted against Csize (predictor).


## CODE SAMPLE ##
# HOS Test
fit.unique <- procD.lm(landmarks~log(Y.gpa$Csize)*clade,data = GDF,iter = 999, RRPP = FALSE)
fit.common <- procD.lm(landmarks~log(Y.gpa$Csize)+clade,data = GDF,iter = 999, RRPP = FALSE)
anova(fit.common, fit.unique, print.progress = FALSE)

# HOS Test Results
                        Df     SS      MS     Rsq       F      Z Pr(>F)  
log(Y.gpa$Csize)         1 0.4435 0.44348 0.11606 37.6306 3.9751  0.001 **
clade                    5 1.7445 0.34891 0.45655 29.6056 8.9186  0.001 **
log(Y.gpa$Csize):clade   5 0.1246 0.02491 0.03260  2.1139 2.5755  0.011 *
Residuals              128 1.5085 0.01179 0.39478                        
Total                  139 3.8211                                        
---

# Pairwise Tests
PWCS1 <- pairwise(fitCS1, groups = GDF$clade, covariate = NULL)

# Pairwise Tests Results 
                                 d UCL (95%)           Z Pr > d
Dermoptera:Haplorhini    0.4719833 0.7622380 -0.12486999  0.546
Dermoptera:Lagomorpha    0.3309339 0.6557384 -0.90485099  0.832
Dermoptera:Rodentia      0.3509109 0.6580135 -0.55442771  0.735
Dermoptera:Scandentia    0.3434920 0.6581346 -0.66242432  0.757
Dermoptera:Strepsirrhini 0.4106187 0.6913430 -0.15750256  0.582
Haplorhini:Lagomorpha    0.3012185 0.3217421  0.40436968  0.335
Haplorhini:Rodentia      0.3095295 0.3409220 -0.55386127  0.713
Haplorhini:Scandentia    0.2896031 0.3252158  0.19255851  0.435
Haplorhini:Strepsirrhini 0.1646892 0.1972740 -0.89521647  0.822
Lagomorpha:Rodentia      0.1058154 0.1268954 -0.43778685  0.670
Lagomorpha:Scandentia    0.1518614 0.1829808  0.26474723  0.388
Lagomorpha:Strepsirrhini 0.2113896 0.2132108  1.56595351  0.062
Rodentia:Scandentia      0.1389013 0.1785683  0.07245211  0.472
Rodentia:Strepsirrhini   0.1962574 0.2100247  0.52212514  0.304
Scandentia:Strepsirrhini 0.1801610 0.1962108  0.96380370  0.170


Marcy, A. E., Guillerme, T., Sherratt, E., Rowe, K. C., Phillips, M. J., & Weisbecker, V. (2020). Australian rodents reveal conserved cranial evolutionary allometry across 10 million years of murid evolution. The American Naturalist196(6), 755-768.

P.S. Had some trouble uploading the figures. Let me know if there are any issues. 
RegScore.png
PredLine.png

agne89

unread,
Mar 24, 2023, 10:58:20 AM3/24/23
to geomorph R package
Hi Madlen,

based on the summary of your fit.unique model I think there is a significance different in allometry between at least some groups. To be more certain though I would also need to see the results of the ANOVA you ran to compare fit.unique and fit.common. When I do my own allometry analysis, I also add to the ANOVA a simple common allometry null model (shape ~ size) with no covariates to clear any doubt and check that the models with  covariates are indeed better than the common slope model.

Assuming that fit.unique is indeed the best model, then to perform a pairwise test on the slopes using the RRPP package you need to slightly change the formula. You will need to add size (logCS) as a covariate as indicated in the help file for the function:
covariate

A numeric vector for which to calculate slopes for comparison If NULL, LS means will be calculated instead of slopes.


Currently you are testing for the difference in LS means which is not equivalent. Also, I prefer to indicate a fit.null model in the formula. I usually use a model like your fit.common model as the null is the ANOVA shows that is significantly different from the simple common allometry model without covariates. 

After you performed the pairwise test, you can easily obtain both absolute differences and angular differences between the slopes using the summary function.

You can find all the details on this and the reasoning behind using a covariate in the pairwise help file:

https://rdrr.io/cran/RRPP/man/pairwise.html


Hope this helps!

Agnese


Maddy Lang

unread,
Mar 24, 2023, 1:36:51 PM3/24/23
to geomorph R package
Hello Agnes,

Thank you for your response, it has been very helpful. Looks like I pasted the incorrect results into the "HOS Test Results" section. What I have pasted below are the correct results showing that the fit.unique model is best supported. I also added the shape ~ size model for comparison (I think this is what you were recommending). I made changes you suggested to the pairwise test function (also below) and now there are differences between groups (hurrah!) which makes much more sense given the plots. 

## HOS Test ##
fit <- procD.lm(landmarks~log(Y.gpa$Csize),data = GDF,iter = 999, RRPP = FALSE)
fit.unique <- procD.lm(landmarks~log(Y.gpa$Csize)*clade,data = GDF,iter = 999, RRPP = FALSE)
fit.common <- procD.lm(landmarks~log(Y.gpa$Csize)+clade,data = GDF,iter = 999, RRPP = FALSE)
anova(fit.common, fit.unique, fit, print.progress = FALSE)
## HOS Test Results ## 
                                            ResDf Df    RSS       SS      MS      Rsq       F       Z     P Pr(>F)
landmarks ~ log(Y.gpa$Csize) + clade (Null)   133  1 1.6331                   0.00000                            
landmarks ~ log(Y.gpa$Csize) * clade          128  5 1.5085  0.12456 0.02491  0.03260  2.1139  2.5755 0.011      
landmarks ~ log(Y.gpa$Csize)                  138 -5 3.3776 -1.74453 0.34891 -0.45655 14.2554 -1.3089 0.918   

## Pairwise Test ## 
PW<- pairwise(fit = fit.unique, fit.null = fit.common, groups = GDF$clade, covariate = Y.gpa$Csize)

## Pairwise Test Results  ## 
Pairwise distances between slope vector
            (end-points), plus statistics

                                   d   UCL (95%)            Z Pr > d
Dermoptera:Haplorhini    0.067946028 0.120612499 -0.319003885  0.659
Dermoptera:Lagomorpha    0.067618144 0.120491919 -0.336971927  0.666
Dermoptera:Rodentia      0.068196518 0.120355028 -0.307085009  0.652
Dermoptera:Scandentia    0.068970353 0.121599947 -0.272950678  0.636
Dermoptera:Strepsirrhini 0.068146736 0.120559611 -0.309299477  0.654
Haplorhini:Lagomorpha    0.002726222 0.002125920  2.716142525  0.001
Haplorhini:Rodentia      0.001473782 0.001110614  3.004400937  0.002
Haplorhini:Scandentia    0.004213266 0.005880644  0.429163262  0.335
Haplorhini:Strepsirrhini 0.001446001 0.001470172  1.624251454  0.057
Lagomorpha:Rodentia      0.002721349 0.002002280  2.878536646  0.001
Lagomorpha:Scandentia    0.004739361 0.006051119  0.774056134  0.222
Lagomorpha:Strepsirrhini 0.003241142 0.002210166  3.165289268  0.001
Rodentia:Scandentia      0.003394315 0.005756891 -0.428136818  0.671
Rodentia:Strepsirrhini   0.001357122 0.001303721  1.819676409  0.035
Scandentia:Strepsirrhini 0.003834496 0.005833378  0.004484563  0.484


Best wishes,

Madlen

agne89

unread,
Mar 25, 2023, 3:50:50 PM3/25/23
to geomorph R package
Hi Madlen,

Yes this looks good!
Glad it worked :)

Agnese
Reply all
Reply to author
Forward
0 new messages