Re: [MORPHMET] Newly added samples as outliers in TPS file

2016-06-27 Thread Collyer, Michael
Anurag,

I assume you are doing one GPA for the combined data and not combining the data 
after GPA has been performed separately on both subsets.  The latter surely 
could lead to the problem you describe.

I recommend, if you have not done so already, using the plotOutliers function.  
It will provide specimen numbers for outliers.  Then you can use 
plotRefToTarget, following the examples in the help file but with your data and 
the specific specimen numbers that concern you, so that you can get a visual 
idea of why these specimens are divergent in shape from the others.  You should 
be able to ascertain whether there was a procedural error (like flipping the 
order of two landmarks), digitizing bias (like one person tends to put 
landmarks more to the left, and another more to the right for vague anatomical 
points), or natural variation (maybe the specimens are just different).

There is nothing in the gpagen function  - or Generalize Procrustes analysis, 
in general - that would inherently introduce a bias to only certain 
configurations.

Good luck solving this!

Michael Collyer

Associate Professor
Biostatistics
Department of Biology
Western Kentucky University
1906 College Heights Blvd. #11080
Bowling Green, KY 42101-1080
Phone: 270-745-8765; Fax: 270-745-6856
Email: michael.coll...@wku.edu

On Jun 27, 2016, at 1:45 PM, Anurag Mishra 
> wrote:

I had assigned landmarks to a group of specimen images (lizard heads) in tpsDIG 
and stored them as a .TPS file. I later wished to add a few more samples (of 
specimens from other locations, images photographed by others that were sent to 
me via mail) so I added the same landmarks in the same order and appended the 
new specimens to my existing .tps file.

However, after applying a Generalized Procrustes Analysis (gpagen function in 
Geomorph package), when I generate a PCA plot, I get the new samples as 
outliers. I am quite positive that the newly acquired specimens should not be 
so different from the data I already had. Is there anything I am doing wrong? 
To my understanding, the images being taken by different sources should not 
matter because gpagen function transforms all the landmarks orientations to 
represent only shape data.

--
MORPHMET may be accessed via its webpage at 
http://www.morphometrics.org
---
You received this message because you are subscribed to the Google Groups 
"MORPHMET" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
morphmet+unsubscr...@morphometrics.org.

-- 
MORPHMET may be accessed via its webpage at http://www.morphometrics.org
--- 
You received this message because you are subscribed to the Google Groups 
"MORPHMET" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to morphmet+unsubscr...@morphometrics.org.


Re: [MORPHMET] replacing df with principal components for MANOVA tests

2016-04-05 Thread Collyer, Michael
Apology for the confusion.  I had intended that one could use randomization 
tests for Procrustes residuals rather than obtaining PC scores, and various 
functions in R will allow this, even if the number of shape variables exceeds 
the number of subjects.

I just checked, and prcomp will naturally reduce the dimensions of the $x 
matrix if the number of variables exceeds the number of subjects to be the 
lesser of the number of variables or n-1, where n is the number of subjects.  
(Note: it might return n PCs instead of n-1, but the PC scores are effectively 
0 in the last PC.)  It will not, however, reduce the number of dimensions 
because of e.g., invariance in scale, orientation, or location of the landmark 
configurations, following GPA.  If one were to convert Procrustes residuals to 
PC scores, and not remove excess PCs, the manova function in R will treat these 
as credible variables even though the number of variables exceeds the actual 
dimensionality of the data space.  If one performs a procedure as follows:

Y <- prcomp(my.Procrustes.residuals)$x
summary(manova(Y ~ x1 + x2 + …))

The manova function has no mechanism for correcting for the extra Y dimensions. 
 It will either blow up (best case scenario) or tack on extra df in the summary 
(even worse).  (The determinant of crossprod(Y) should be close 0, which should 
arrest the function, but I’m not sure about the manova traps.)  However, if one 
does this:

PCA <- prcomp(my.Procrustes.residuals)
Y <- PCA$x[, zapsmall(PCA$sdev) > 0]
summary(manova(Y ~ x1 + x2 + …))

The number of columns in Y will be the lesser of n-1 or the number of 
Procrustes residuals times the dimensions used for the landmarks, minus the 
invariant dimensions (because of scaling, orientation, and centering, and maybe 
use of semilandmarks).  This will not alleviate the issues Dr. Rohlf pointed 
out.  In fact, the manova.summary function will return an error if the number 
of columns of Y exceeds the error degrees of freedom for the model used.  Thus, 
if prcomp is being used simply because the number of variables exceeds the 
number of research subjects, problems will likely persist with the parametric 
approach.

By “culling the dimensions” I was referring to removing the superfluous PCs, 
specifically when using prcomp to do PCA  (as it won’t), not advocating any 
chicanery for manipulating MANOVA.

Mike

Michael Collyer

Associate Professor
Biostatistics
Department of Biology
Western Kentucky University
1906 College Heights Blvd. #11080
Bowling Green, KY 42101-1080
Phone: 270-745-8765; Fax: 270-745-6856
Email: michael.coll...@wku.edu<mailto:michael.coll...@wku.edu>

On Apr 5, 2016, at 1:15 PM, F. James Rohlf 
<f.james.ro...@stonybrook.edu<mailto:f.james.ro...@stonybrook.edu>> wrote:

Note: to give statistically reliable results it needs to do more than just 
“culls the dimensions of x to match the number of positive non-zero 
eigenvalues”. You need to have the number of degrees of freedom much larger 
than the number of dimensions of the space or else you are likely to find that 
the PC dimensions with the smallest eigenvalues apparently account for most of 
the differences among groups. Simply using randomization tests do not solve 
this problem.


F. James Rohlf, Distinguished Professor, Emeritus. Ecology & Evolution
Research Professor, Anthropology
Stony Brook University

From: Collyer, Michael [mailto:michael.coll...@wku.edu]
Sent: Tuesday, April 5, 2016 5:29 AM
To: Brenna Hays <bkhays...@gmail.com<mailto:bkhays...@gmail.com>>
Cc: MORPHMET <morphmet@morphometrics.org<mailto:morphmet@morphometrics.org>>
Subject: Re: [MORPHMET] replacing df with principal components for MANOVA tests

Brenna,

The PCA you performed produces a list of objects, one of which is a matrix of 
PC scores.

Change AIS.PC to AISPC$x, and it should work.  In this case, $x is the matrix 
of scores.

The help files for the functions you use tell you the objects that are 
returned.  You can also use attributes() to see the list of objects returned.  
The $ indicate that you are going to the list and extracting the object that 
follows.

Just as a cautionary note, you might make sure that the number of columns for x 
is not the same as the number of landmarks times the dimensions (2 or 3).  I 
cannot remember if R automatically culls the dimensions of x to match the 
number of positive non-zero eigenvalues.  If not, you might have to do that 
yourself.  There are also non-parametric MANOVA options that do not rely on 
degrees of freedom, which would make theses steps unnecessary, if you are 
comfortable with using randomization tests.

Good luck!
Mike

Michael Collyer

Associate Professor
Biostatistics
Department of Biology
Western Kentucky University
1906 College Heights Blvd. #11080
Bowling Green, KY 42101-1080
Phone: 270-745-8765; Fax: 270-745-6856
Email: michael.coll...@wku.edu<mailto:

Re: [MORPHMET] replacing df with principal components for MANOVA tests

2016-04-05 Thread Collyer, Michael
Brenna,

The PCA you performed produces a list of objects, one of which is a matrix of 
PC scores.

Change AIS.PC to AISPC$x, and it should work.  In this case, $x is the matrix 
of scores.

The help files for the functions you use tell you the objects that are 
returned.  You can also use attributes() to see the list of objects returned.  
The $ indicate that you are going to the list and extracting the object that 
follows.

Just as a cautionary note, you might make sure that the number of columns for x 
is not the same as the number of landmarks times the dimensions (2 or 3).  I 
cannot remember if R automatically culls the dimensions of x to match the 
number of positive non-zero eigenvalues.  If not, you might have to do that 
yourself.  There are also non-parametric MANOVA options that do not rely on 
degrees of freedom, which would make theses steps unnecessary, if you are 
comfortable with using randomization tests.

Good luck!
Mike

Michael Collyer

Associate Professor
Biostatistics
Department of Biology
Western Kentucky University
1906 College Heights Blvd. #11080
Bowling Green, KY 42101-1080
Phone: 270-745-8765; Fax: 270-745-6856
Email: michael.coll...@wku.edu

On Apr 5, 2016, at 10:16 AM, Brenna Hays 
> wrote:

I have been reading up on MANOVA and come across the common complication 
requiring a large number of degrees of freedom. After performing Procrustes 
superimpositions on my landmark configurations, along with my small sample 
sizes, is not allowing me to perform MANOVA tests.

I have read that one can fix this problem by replacing the coordinates with 
principal components. The coding from my information source is very vague, but 
I've been trying some different things. Below is my code - note the error 
message at the bottom.

AISarray <- two.d.array(AIS.shape)

ID <- c(1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3)
Depth <- c(3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5)
Region <- c(7, 8, 8, 8, 8, 8, 8, 8, 5, 5, 5)
RR <- c(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2)
CDR <- c(2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)

AISdf <- cbind(AISarray, ID, Depth, Region, RR, CDR)

specs <- as.factor(AISdf[,51])
depth <- as.factor(AISdf[,52])
region <- as.factor(AISdf[,53])
rr <- as.factor(AISdf[,54])
cdr <- as.factor(AISdf[,55])

AIS.PC <- prcomp(AISarray)
summary(manova(lm(AIS.PC~specs*region))) #NOT WORKING
Error in model.frame.default(formula = AIS.PC ~ specs * region, 
drop.unused.levels = TRUE) :
  invalid type (list) for variable 'AIS.PC'

It seems MANOVA requires a data frame, but replacing the coordinates with 
principal components turns it into a list. I cannot find any other information 
on this matter. Any help would be much appreciated.
Thanks,

Brenna Hays
Research Assistant, Master's Student
Nova Southeastern University

--
MORPHMET may be accessed via its webpage at 
http://www.morphometrics.org
---
You received this message because you are subscribed to the Google Groups 
"MORPHMET" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
morphmet+unsubscr...@morphometrics.org.

-- 
MORPHMET may be accessed via its webpage at http://www.morphometrics.org
--- 
You received this message because you are subscribed to the Google Groups 
"MORPHMET" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to morphmet+unsubscr...@morphometrics.org.


Re: [MORPHMET] problems with nested ANOVA

2016-03-04 Thread Collyer, Michael
Dear Brenna,

There is a lot to digest here, so apologies up front if I miss something.  
Also, I’ll keep my response general for the benefit of our colleagues.  We can 
work out specific issues with your data and your analyses via direct email 
communication.

First, you have two sets of shape variables that you present so it is difficult 
to compare your different results and understand exactly the problem, but I see 
a couple of things.  I’m surprised you did not get an error message, as we set 
traps to avoid the type of nested analysis you were trying to perform.  
Currently, nested.update is not that sophisticated to handle a structure like ~ 
a/b/c.  You eluded the trap, somehow (I’ll have to look into this), but if c is 
nested within b and b is nested with a, and one wants to adjust F values such 
that F for b = MSb/MSc and F for a = MAa/MSb, the procedure should be to use a 
recursive strategy with nested.update, to update the fit first by ~b/c, then 
use that update and update it again with ~a/b.  I’m not sure what to tell you 
about the results because I am surprised you got results.

Second, the reason for the same results in your second and third example is 
that bout/rep is the same the error.  In this case, nested.update will not 
accomplish anything, other than identify that there are no residuals after you 
account for your nested effect.

Third, your centroid size (near) invariance appears to have resulted from 
performing GPA on a subset of data that already had GPA performed.  You found a 
significant shape-size association despite what appeared to be little 
variation, but this might just be a scaling issue.  For example, multiply the 
centroid size values by 1 and re-run the analysis.  The SS and MS will 
change, and the new variable will seem less invariant, but I suspect the 
F-value and P-value will not change.

Good luck and feel free to send me your data-specific questions!

Mike

Michael Collyer

Associate Professor
Biostatistics
Department of Biology
Western Kentucky University
1906 College Heights Blvd. #11080
Bowling Green, KY 42101-1080
Phone: 270-745-8765; Fax: 270-745-6856
Email: michael.coll...@wku.edu

On Mar 4, 2016, at 2:45 PM, Brenna Hays 
> wrote:

Hi All,

I am trying to perform a nested ANOVA in R to test for repeatability and 
subjectivity of landmark placements on three randomly chosen images. I have 
landmarked each image 10 times, in 2 separate bouts (a few months apart).

This is my result from incorporating the entire data set into a nested ANOVA:
#nested ANOVA
error <- procD.lm(f1=ALLlp.shape~ind/bout/rep, iter=999, RRPP=TRUE, data=NULL)
error <- nested.update(error, ~ind/bout/rep)
summary(error)
Call:
procD.lm(f1 = ALLlp.shape ~ ind/bout/rep, iter = 999, RRPP = TRUE,  data = 
NULL)

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

Df  SS  MS Rsq   F  
 Z  Pr(>F)
ind20.71265   0.35632  0.98767  1410.6169   19.2446  0.001 
**
ind:bout10.00276   0.00276  0.00383   10.9405  13.4952  0.001 **
ind:bout:rep 36   0.00108   0.3  0.001500.11910.2891  1.000
Residuals20   0.00505   0.00025
Total 59 0.72155
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

I was concerned, however, that these results are comparing between individuals 
(images) which I do not want, since all three images are of different 
individuals. Really, I just want to test variance between bouts and reps, so I 
performed separate nested ANOVAs for each individual. Here is the result for 
one of the individuals (note: it will not let me put the ind factor in since 
for each separate test there is only one category (1 image)):
> error = procD.lm(f1=CochaClp.shape~bout/rep, iter=999, RRPP=TRUE, data=NULL)
> error <- nested.update(error, ~bout/rep)
> summary(error)
Call:
procD.lm(f1 = CochaClp.shape ~ bout/rep, iter = 999, RRPP = TRUE,  data = 
NULL)

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

*** F values, Z scores, and P values updated for nested effects

Df SS MS   Rsq  F   
 Z   Pr(>F)
bout  1   0.00238108  0.00238108   0.75651  55.925   9.0398  0.001 **
bout:rep   18  0.00076637  0.4258   0.243491.0534  0.001 **
Residuals  0  0.
Total19  0.00314745

I also performed an ANOVA on just the bout factor to see. I don't know if the 
residual sum of squares and mean squares should match the bout:rep numbers 
above, but it doesn't seem right to me.
> errorb = procD.lm(CochaClp.shape~bout, iter=999, RRPP=TRUE)
> summary(errorb)
Call:
procD.lm(f1 = CochaClp.shape ~ bout, iter = 999, RRPP = TRUE)

Type I 

[MORPHMET] geomorph update

2016-03-03 Thread Collyer, Michael
Colleagues,

We have made a small update to the procD.allometry function to fix a bug with 
centering shape data to calculate CAC scores.  Thanks to Borja Figueirido for 
discovering the problem!

As always, updates to geomorph are made available via our GitHub repository, 
and the latest version of geomorph can be installed with one line of code in R:

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

Cheers!
Mike

Michael Collyer

Associate Professor
Biostatistics
Department of Biology
Western Kentucky University
1906 College Heights Blvd. #11080
Bowling Green, KY 42101-1080
Phone: 270-745-8765; Fax: 270-745-6856
Email: michael.coll...@wku.edu

-- 
MORPHMET may be accessed via its webpage at http://www.morphometrics.org
--- 
You received this message because you are subscribed to the Google Groups 
"MORPHMET" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to morphmet+unsubscr...@morphometrics.org.


Re: [MORPHMET] Sliding Semilandmarks

2016-02-18 Thread Collyer, Michael
Andrea,

I like to think of semilandmark sliding as iteratively finding fitted 
(predicted) values for the generalized linear model fit described by Gunz et 
al. (2005) (equation 4), and updating coordinates by these values until there 
is no more meaningful change (with regard to an acceptable criterion).  If 
Bending energy is not used, the bending energy matrix is replaced by an 
identity matrix (i.e., independence), which produces the minimized Procrustes 
distance version of the sliding algorithm.  (This is is the same as ordinary 
least squares being a simplification of generalized least squares by using an 
identity matrix for the covariance matrix in GLS estimation of parameters.)  
Calculating the bending energy matrix requires using the reference 
configuration.  The hat matrix calculated in the process is typically 
post-multiplied by the target coordinates centered by the reference 
configuration.  Changing the reference should, therefore, change the solution.  
Also, let’s not forget that with surface points, if we follow the Gunz et al. 
(2005) recommendation, 5 nearest neighbors are used to estimate the principal 
components for defining a tangent plane.  One could use more nearest neighbors, 
which would change the tangent planes.  One could also choose to project points 
after sliding back onto the surface (by finding the nearest neighbor) or not.  
One could choose to recursively update the reference configuration as the 
Procrustes average in each iteration, or use a constant reference.  One could 
also choose different convergence criteria, depending on how precise the 
finished product should be.  This is all to say that there are several - 
perhaps arbitrary - choices that can be made that will affect the results.

Whether these nuances have an appreciable empirical effect, I’m not sure.  I 
doubt that shape distances would change “remarkably” (depending on one’s 
definition of remarkable), but I think one cannot expect that subsampling will 
produce the same Procrustes residuals that would be found from using one 
inclusive sample.

As you have indicated, the same thing happens with GPA performed on “fixed” 
landmarks.  The extent to which surface semilandmarks would be similar or more 
susceptible to change is hard to argue without considering whether bending 
energy is used, how many nearest neighbors are used, the relative density of 
surface points, etc. This is probably a question to answer empirically with 
specific data.  (Get Procrustes residuals from the full data, do it again with 
subsetted data, and maybe do a two-block PLS analysis between two sets of 
matching specimens to see if there is any appreciable change.)

I would be curious to know what others think.  I have been thinking about this 
topic a lot, especially after dealing with the programming in geomorph.  I’m 
sure there are other perspectives.

Mike

Michael Collyer

Associate Professor
Biostatistics
Department of Biology
Western Kentucky University
1906 College Heights Blvd. #11080
Bowling Green, KY 42101-1080
Phone: 270-745-8765; Fax: 270-745-6856
Email: michael.coll...@wku.edu<mailto:michael.coll...@wku.edu>

On Feb 18, 2016, at 11:03 AM, andrea cardini 
<alcard...@gmail.com<mailto:alcard...@gmail.com>> wrote:

Mike, does this mean that, in general, the position of the semilandmarks is 
strongly sample dependent, which would mean that also the shape distances might 
change remarkably despite the fact one has the same number of points on exactly 
the same surface?
Say that I have two samples, A and B. I first (1) superimpose (and slide) 
within A. Then I do the same with both A and B together (2). Could I get 
appreciable differences between A1 and A2 just because of the sliding?

All Procrustes shape distances depend on the sample composition. However, in my 
experience, differences between A1 and A2 tend to be negligible with 'standard' 
landmarks. Is this different with semilandmarks? Are there sensitivity analyses 
that explore the issue (if it's an issue)?

Thanks in advance.
Cheers

Andrea

At 17:06 18/02/2016, Collyer, Michael wrote:
Contrary to your logic, subsetting your sample could have an effect.  Your mean 
configuration would change in each of the subsamples, from the mean of your 
original sample, thus changing the reference configuration used in the separate 
GPAs performed.  The reference configuration has a prominent role in the 
sliding of landmarks.


Dr. Andrea Cardini
Researcher, Dipartimento di Scienze Chimiche e Geologiche, Università di Modena 
e Reggio Emilia, Via Campi, 103 - 41125 Modena - Italy
tel. 0039 059 2058472

Adjunct Associate Professor, Centre for Forensic Science , The University of 
Western Australia, 35 Stirling Highway, Crawley WA 6009, Australia

E-mail address: alcard...@gmail.com<mailto:alcard...@gmail.com>, 
andrea.card...@unimore.it<mailto:andrea.card...@unimore.it>
WEBPAGE: https://sites.google.com/site/alcardini/home/main


Re: [MORPHMET] Sliding Semilandmarks

2016-02-18 Thread Collyer, Michael
Ari,

If you are using geomorph, you might want to update it via GitHub.  Just a few 
days ago we updated the software with some bug fixes for surface points (one 
bug fix was for assuring non-arbitrary directions in PC planes for tangents of 
surface points).  If you are unsure how to do that, look at the post by Dean 
Adams on 15 February 2016.

Beyond that, you are asking for assistance without defining (1) how you are 
sliding your landmarks (minimizing Procrustes Distance or Bending Energy) or 
(2) other specifics that might be important (package within R, maybe other 
inputs that might be important, such as the relative numbers of fixed landmarks 
and semilandmarks, etc.).

Contrary to your logic, subsetting your sample could have an effect.  Your mean 
configuration would change in each of the subsamples, from the mean of your 
original sample, thus changing the reference configuration used in the separate 
GPAs performed.  The reference configuration has a prominent role in the 
sliding of landmarks.

With the information you provided, t is not possible to discern among user 
error, program error, or analytical artifact.

Mike

Michael Collyer

Associate Professor
Biostatistics
Department of Biology
Western Kentucky University
1906 College Heights Blvd. #11080
Bowling Green, KY 42101-1080
Phone: 270-745-8765; Fax: 270-745-6856
Email: michael.coll...@wku.edu

On Feb 18, 2016, at 9:43 AM, Ariadne Schulz 
> wrote:

Hello all,

I'm having a bit of a semilandmark problem. I'm working on 3D surfaces with 
semilandmarks. (Profuse thank yous to Emma for writing the scripts for that.) 
The issue I'm having I think is occurring in the sliding. When I do populations 
alone everything seems normal. The semilandmarks do not appear to be going off 
the surface defined for them, but if I try to do more than one population at 
once several of the semilandmarks slide off the surface so my PCs get rather 
distorted. Based on the few individuals from different populations I've looked 
at I think I do have interpopulation variation but I wouldn't expect that to 
influence the sliding of semilandmarks. Has anyone else encountered an issue 
like this with either 2D or 3D semilandmarks? As with all things R I expect the 
answer will be something like me omitting a comma somewhere so any suggestions 
you might have are welcome.

Best,
Ari

--
MORPHMET may be accessed via its webpage at 
http://www.morphometrics.org
---
You received this message because you are subscribed to the Google Groups 
"MORPHMET" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
morphmet+unsubscr...@morphometrics.org.

-- 
MORPHMET may be accessed via its webpage at http://www.morphometrics.org
--- 
You received this message because you are subscribed to the Google Groups 
"MORPHMET" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to morphmet+unsubscr...@morphometrics.org.


Re: [MORPHMET] plotTangentSpace() versus prcomp() in geomorph

2016-01-19 Thread Collyer, Michael
Dear Brenna,

It appears the problem is that you are attempting to use prcomp on your 
points(p) x dimensions(k) x n Procrustes coordinates without converting these 
data into a n x pk matrix, required by prcomp.  Unfortunately, prcomp will use 
the first p x k part of the array of coordinates, resulting in an illogical PCA 
(rather than provide an error).  If you were to first use two.d.array to 
convert your 3D array of coordinates into a 2D matrix, and subsequently perform 
the PCA via prcomp on this converted matrix, you will get the same results as 
plotTangentSpace.  In fact, plotTangentSpace starts by converting your data 
into a matrix with two.d.array and using prcomp to do the PCA.  Most of the 
other coding for this function is to generate the plot.  So getting different 
answers should not be possible.

Good luck!

Michael Collyer

Associate Professor
Biostatistics
Department of Biology
Western Kentucky University
1906 College Heights Blvd. #11080
Bowling Green, KY 42101-1080
Phone: 270-745-8765; Fax: 270-745-6856
Email: michael.coll...@wku.edu

On Jan 19, 2016, at 2:09 PM, Brenna Hays 
> wrote:

Hello,
I am trying to perform a PCA on a basic set of 30 configurations, 3 specimens 
each with 10 configurations of landmarks. I was wondering why I am getting 
different PCA results between plotTangentSpace() and prcomp(). When I perform 
plotTangentSpace(), it gives me a comprehensive list of 30 PCs and their 
importance (PC1 and PC2 make up 99% of the variance). But when I perform the 
prcomp() (which is the function most recommended in the literature), the 
summary says PC1 explains 100% of the variance, and because of this I cannot 
perform the screeplot() or plot().
Am I missing something? I have copied my coding below. Any help would be much 
appreciated.


lpALL.super <- gpagen(lpALL, Proj=TRUE, ProcD=TRUE, PrinAxes=TRUE, 
ShowPlot=TRUE, curves=NULL, surfaces=NULL)
lpALL.shape <- lpALL.super$coords
lpALL.size <- lpALL.super$Csize
names(lpALL.super)

plotTangentSpace(lpALL.shape, axis1=1, axis2=2, warpgrids=TRUE, mesh=NULL, 
label=TRUE, verbose=TRUE) <- PC1 and PC2 99%

max(lpALL.shape[ ,1, ]); min(lpALL.shape[ ,1, ]); max(lpALL.shape[ ,2, ]); 
min(lpALL.shape[ ,2, ])

plot(lpALL.shape[ ,1,1:10], lpALL.shape[ ,2,1:10], asp=1, pch=21, bg="red", 
xlab="x", ylab="y", cex=.8, xlim=c(-0.295,0.252), ylim=c(-0.234,0.224))
points(lpALL.shape[ ,1,11:20], lpALL.shape[ ,2,11:20], asp=1, pch=21, 
bg="blue", cex=.8)
points(lpALL.shape[ ,1,21:30], lpALL.shape[ ,2,21:30], asp=1, pch=21, 
bg="green", cex=.8)
legend('bottomright', legend=c("CochaC", "CochaD", "DorbrA"), fill=c("red", 
"blue", "green"), cex=1)

lpALLPC <- prcomp(lpALL.shape, center=TRUE, scale=TRUE)
names(lpALLPC)
lpALLPC$x
lpALLPC$sdev
lpALLPC$rotation
summary(lpALLPC, scale=TRUE) <- PC1 100%
require(vegan)
screeplot(lpALLPC, npcs=15, type="lines", bstick=TRUE)
plot(lpALLPC$x[ ,1:2], asp=1, pch=21, cex=2.5, bg="black") <- subscript [ 1:2] 
out of bounds

--
MORPHMET may be accessed via its webpage at 
http://www.morphometrics.org
---
You received this message because you are subscribed to the Google Groups 
"MORPHMET" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
morphmet+unsubscr...@morphometrics.org.

-- 
MORPHMET may be accessed via its webpage at http://www.morphometrics.org
--- 
You received this message because you are subscribed to the Google Groups 
"MORPHMET" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to morphmet+unsubscr...@morphometrics.org.


Re: [MORPHMET] Estimating Ontogenetic Trajectories

2015-08-24 Thread Collyer, Michael
This is correct.  The function, trajectory.analysis, compares multi-point 
trajectories; therefore, age would need to be modeled as a categorical variable 
(factor).  If one wishes to have age (or similar variable) in the model as a 
continuous variable, then advanced.procD.lm would be more appropriate.  This 
function allows comparisons of slopes among groups.  The two functions are 
similar, in that they allow evaluation of the length and direction of group 
trajectories, although the trajectories in advancad.procD.lm are vectors.  One 
can consider non-linear trajectories in trajectory.analysis.

Hope that helps!

Michael Collyer

Associate Professor
Biostatistics
Department of Biology
Western Kentucky University
1906 College Heights Blvd. #11080
Bowling Green, KY 42101-1080
Phone: 270-745-8765; Fax: 270-745-6856
Email: michael.coll...@wku.edumailto:michael.coll...@wku.edu

On Aug 24, 2015, at 12:11 AM, lv xiao 
lxia...@gmail.commailto:lxia...@gmail.com wrote:

In the botton line of page 53 of Quick Guide to Geomorph v2.1.6 regarding 
trajectory.analysis (Y ~ cov + A * B), A and B are called factors, which 
seems to suggest that A and B are categorical variables. Continuous covariates 
could be included in the formula, but this is only optional. In contrast, it 
seems that there must be two categorical variables (A and B) appearing in the 
formula.

Following this line of thought, I am wondering if is there the need to convert 
the continuous age variable (age) into a categorical variable (age_cat) before 
applying the trajectory analysis. I am not sure whether one should use 
trajectory.analysis(shape ~ group * age_cat ) or trajectory.analysis(shape ~ 
group * age).

Best regards,
Patrick

On Monday, 24 August 2015 10:56:55 UTC+8, Emma Sherratt wrote:
Dear Miranda,

Using procD.lm is the correct function for what you want to do. Since you have 
just two groups it's a simple Procrustes Anova. Your implementation should be:

procD.lm(shape~ age*group)

This will give you:

Effect of age; where significant means the shape scales allometrically

Effect of group; where significant means the groups differ in intercept

The interaction term of age and group to tell you if the two groups have the 
same slope (interaction term not significant) or the slopes differ (sig 
interaction term)

Then from this you will be able to deduce whether the two groups follow the 
same allometric trajectory or not. But remember, you are dealing with 
multivariate regression here so there is no positive or negative allometry, 
since the slope is a multivariate vector in shape space.

The same formula into trajectory.analysis should then lead you to where you 
were hoping to go with that.

Emma

On Monday, August 24, 2015, Karban, Miranda E 
miranda-...@uiowa.eduhttp://uiowa.edu/ wrote:
Hello morphometricians,
I am relatively new to morphometrics, and I am attempting to assess ontogenetic 
trajectories from a longitudinal sample of growth study x-rays. My subjects are 
divided into 2 groups, and I would like to determine whether there are 
developmental differences in cranial shape between these groups. I have precise 
ages for each subject, so I hope to use age as a variable (following McNulty et 
al., 2006) rather than centroid size.

From what I gather from the literature, I can estimate ontogenetic 
trajectories by regressing the Procrustes aligned shape coordinates onto the 
independent variable of age. So far, I have attempted to do this in the 
geomorph package in R using the procD.lm and the trajectory.analysis 
functions. I am wondering if I am doing this correctly, or if there is a 
better function to use.

I have tried the following:
lateral.gpa - gpagen(vaultlandmarks)
procD.lm(two.d.array(lateral.gpa$coords) ~ age, iter = 999)

where “vaultlandmarks” refers to the 2D landmark and semi-landmark coordinates 
in my tps file, and “age” refers to a column in my metadata csv file which 
gives the age of each specimen to the nearest 1/10 of a year. This provides a 
sum-of-squared Procrustes distances, a mean square, and a highly significant 
p-value. I am not sure, however, how to compare the results I get from the 2 
groups.

When I try the trajectory.analysis function:
lateral.gpa - two.d.array(gpagen(vaultlandmarks)$coords)
trajectory.analysis(lateral.gpa~age)

I get the error message: “Error in trajectory.analysis(lateral.gpa ~ age) :   
X-matrix does not specify enough model factors (see help file).”

Thank you for any advice or help you might provide.

Best,
Miranda Karban
PhD Candidate, University of Iowa

--
MORPHMET may be accessed via its webpage at 
http://www.morphometrics.orghttp://www.morphometrics.org/

To unsubscribe from this group and stop receiving emails from it, send an email 
to 
morphmet+unsubscribe@mailto:morphmet+unsubscr...@morphometrics.orgmorphometrics.orgmailto:morphmet+unsubscr...@morphometrics.org.


--

~~~

Emma Sherratt, PhD.

Lecturer in 

Re: [MORPHMET] [geomorph] New comment on ANOVAs and Geomorph.

2015-07-11 Thread Collyer, Michael
.  Evol.
Research Professor, Dept. of Anthropology
Stony Brook University
The much revised 4th editions of Biometry and Statistical Tables are now 
available:
http://www.whfreeman.com/Catalog/product/biometry-fourthedition-sokal
http://www.whfreeman.com/Catalog/product/statisticaltables-fourthedition-rohlf
P Please consider the environment before printing this email

From: Collyer, Michael [mailto:michael.coll...@wku.edu]
Sent: Thursday, July 9, 2015 12:56 PM
To: Waldir Miron; MORPHMET
Subject: [MORPHMET] Re: [geomorph] New comment on ANOVAs and Geomorph.

Dear Waldir,

There are both philosophical and practical reasons we do not now or will not 
offer options for choice of sums of squares in procD.lm.  First the practical 
reasons.  It is not trivial to offer such an option. The various sums of 
squares (types 1, 2, 3, etc.) all involve a paradigm of model comparisons. (We 
have a couple of blog posts about this on 
www.geomorph.nethttp://www.geomorph.net/.). If one understands the paradigms, 
advanced.procD.lm allows one to calculate any type of sums of squares (SS).  If 
you are determined to use type 3 SS, I recommend using advanced.procD.lm.

As for the philosophical reason that type 3 SS is not something we offer, it is 
a paradigm we choose not to acknowledge as valid. The reason for this is 
simple. With type 3 SS the sum of the parts exceeds the total. Type 3 SS, as a 
paradigm, involves removing effects from the full model, one by one, and 
calculating the changes in summed squared residuals as the effect SS. For 
unbalanced designs, the sum of SS across effects will exceed the model SS. This 
does not make much sense. Furthermore, the process involves removing main 
effects but retaining any interaction with these effects for calculating SS. 
This is a bit silly. Type 2 SS avoids this problem, and again, 
advanced.procD.lm can accommodate the type 2 approach.

By contrast, type 1 SS involves sequentially adding model effects and 
calculating the change in summed squared residuals as the effect SS. The sum of 
SS across the effects is the same as the full model SS. The order of effects is 
important, but we feel the biologist should have some cognizance of the 
appropriate order.

Because geomorph is an R package, users are free to manipulate functions. Thus, 
it is possible to augment the R script to provide type 3 SS. But this not 
something we will do as a permanent fixture, for the reasons above.

Good luck!

Mike Collyer

Sent from my iPhone

On Jul 9, 2015, at 9:35 AM, Waldir Miron 
noreply-comm...@blogger.commailto:noreply-comm...@blogger.com wrote:
Waldir Mironhttp://www.blogger.com/profile/10564967218097034020 has left a 
new comment on your post ANOVAs and 
Geomorphhttp://www.geomorph.net/2015/04/anovas-and-geomorph.html:

Dear (s),

I am investigating fish shape variaton from different rivers basins and 
habitats within river basins. However, I have an unbalaced samples for both 
factors, it is recommended to do an Anova with SS error type III (marginal), to 
avoid some sampling bias.

Unfortunately, I tried several times but I was not able to calculate SS type 
III using the Procrustes coordinates with the procD.lm function from geomorph 
package. It seems that the default type error of the function is the type I, 
and I would like to know if there is any argument to change that or a way to do 
it. I would appreciate any help.

Regards.



Posted by Waldir Miron to geomorphhttp://www.geomorph.net/ at July 9, 2015 at 
9:35 AM
--
MORPHMET may be accessed via its webpage at 
http://www.morphometrics.orghttp://www.morphometrics.org/
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
morphmet+unsubscr...@morphometrics.orgmailto:morphmet+unsubscr...@morphometrics.org.

-- 
MORPHMET may be accessed via its webpage at http://www.morphometrics.org

To unsubscribe from this group and stop receiving emails from it, send an email 
to morphmet+unsubscr...@morphometrics.org.


[MORPHMET] New Evolution paper for phylogenetic comparative analyses of shape data

2015-05-25 Thread Collyer, Michael
Folks, we apologize for the delayed announcement but wanted the morphometrics 
community to be aware of a new paper we have recently published.  We compared 
two methods for performing phylogenetic regression using shape data (PIC vs 
D-PGLS).  In it we demonstrate that while test statistics from both are the 
same (SS, MS, F etc), P-values can differ dramatically.  The reason is that 
current randomization tests with PIC-based methods use an incorrect permutation 
procedure, which results in very high type I error rates.  We discuss this 
relative to correct exchangeable units for permutation procedures, and provide 
a solution.

Here are the paper details: Adams, DC and Collyer, ML. 2015. Permutation tests 
for phylogenetic comparative analyses of high-dimensional shape data: What you 
shuffle matters. Evolution 69 (3): 823-829. (March 2015 issue)

Warm regards!

Michael Collyer

Associate Professor
Biostatistics
Department of Biology
Western Kentucky University
1906 College Heights Blvd. #11080
Bowling Green, KY 42101-1080
Phone: 270-745-8765; Fax: 270-745-6856
Email: michael.coll...@wku.edumailto:michael.coll...@wku.edu

-- 
MORPHMET may be accessed via its webpage at http://www.morphometrics.org

To unsubscribe from this group and stop receiving emails from it, send an email 
to morphmet+unsubscr...@morphometrics.org.


Re: [MORPHMET] Not verbose output in plotAllometry (Geomorph 2.1.4)

2015-04-28 Thread Collyer, Michael
Thanks for the alert Alejo!  This was the result of one missing word in the 
code.  It has been fixed (I hope) and you can update geomorph via Github, if 
you like.

e.g.,

devtools::install_github(“EmSherratt/geomorph”)

Note that this requires having devtools installed.

Cheers!
Mike

Michael Collyer

Assistant Professor
Department of Biology
Western Kentucky University
1906 College Heights Blvd. #11080
Bowling Green, KY 42101-1080
Phone: 270-745-8765; Fax: 270-745-6856
Email: michael.coll...@wku.edumailto:michael.coll...@wku.edu

On Apr 27, 2015, at 1:58 PM, Alejo Scarano 
alejo.c.scar...@gmail.commailto:alejo.c.scar...@gmail.com wrote:

Hi all, I have tried with different databases to verbose output in 
plotAllometry without success. Possible bug?
Thanks in advance

--
MORPHMET may be accessed via its webpage at 
http://www.morphometrics.orghttp://www.morphometrics.org/

To unsubscribe from this group and stop receiving emails from it, send an email 
to 
morphmet+unsubscr...@morphometrics.orgmailto:morphmet+unsubscr...@morphometrics.org.

-- 
MORPHMET may be accessed via its webpage at http://www.morphometrics.org

To unsubscribe from this group and stop receiving emails from it, send an email 
to morphmet+unsubscr...@morphometrics.org.


Re: [MORPHMET] A question about PCA in geomorph

2015-04-12 Thread Collyer, Michael
Mauro, plus others,

As a follow up, we are also working on a new function in geomorph to allow 
users to modify transformation (deformation) grids.  Much like the R par 
function, this function will allow users to vary the colors, width, and style 
of grid lines and link links, the density of grid points, and the color and 
size of landmarks.  This function will be available in the near future.

Michael Collyer

Assistant Professor
Department of Biology
Western Kentucky University
1906 College Heights Blvd. #11080
Bowling Green, KY 42101-1080
Phone: 270-745-8765; Fax: 270-745-6856
Email: michael.coll...@wku.edumailto:michael.coll...@wku.edu

On Apr 12, 2015, at 8:05 AM, Mauro Cavalcanti 
mauro...@gmail.commailto:mauro...@gmail.com wrote:

Dear Emma  ALL,

Indeed, when reading my data with readland.nts I get the data in the format 
required by the geomorph analytical routines. The problem is that I was calling 
by mistake a routine from Ian Dryden's shapes package (procGPA) to generate the 
Procrustes-aligned coordinates, instead of the gpagen routine. Fixed this and 
now everything works fine.

I take this opportunity to ask another question, this time relating to the 
plots generated by geomorph. Is there a way to customize them, including for 
example axis labels in the PCA plots? In fact, the Quick Guide shows these 
plots with labels, but I could not figure out how to include them in my plots. 
Calling the R par function (as one should have done when using the usual plot 
command) did not work.

Again, thanks for your help.

Best regards,.

2015-04-12 1:39 GMT-03:00 Emma Sherratt 
emma.sherr...@gmail.commailto:emma.sherr...@gmail.com:
Mauro,

If you read in your NTS data file using readland.nts, it will automatically be 
in the 3D array format required by plotTangentSpace (after you use gpagen to do 
a Procrustes Superimposition).

If you have your data as a 2D matrix, you simply use arrayspecs to make it a 3D 
array.

Emma

On Sunday, April 12, 2015, Mauro Cavalcanti 
mauro...@gmail.commailto:mauro...@gmail.com wrote:
Dear ALL,

I have a number of questions about the geomorph R package, that I will post 
here in separate messages.

First one concerns Principal Components Analysis, using the plotTangentSpace 
routine. It requires a 3D matrix as argument, however my data (on fishes) are 
2D and I could not figure out how to convert my data to the required format; 
the explanation of the arrayspecs routine in the Quick Guide to Geomorph was 
not clear for me (and it lacks a workin exemple).

My data are read from a NTSYSpc file containing 2D coordinates for 10 landmarks 
for a number of fish specimens, using the readland.nts routine. I have been 
able to perform a PCA on these data using the shapepca routine in Ian Dryden's 
shapes R package, but would like to perfom the entire analysis using geomorph.

Thanks in advance for any hints!

Best regards,

--
Dr. Mauro J. Cavalcanti
E-mail: mauro...@gmail.com
Web: maurobiohttp://sites.google.com/site/maurobio

--
MORPHMET may be accessed via its webpage at 
http://www.morphometrics.orghttp://www.morphometrics.org/

To unsubscribe from this group and stop receiving emails from it, send an email 
to morphmet+unsubscr...@morphometrics.org.


--

~~~

Emma Sherratt, PhD.

Lecturer in Zoology,
Zoology Division, School of Environmental and Rural Science,
Room L120 Bldg C02,
University of New England,
Armidale, NSW, Australia, 2351
Tel: +61 2 6773 5041
email: emma.sherr...@une.edu.aumailto:emma.sherr...@une.edu.au
Twitter: @DrEmSherratt


Caecilians are legless amphibians...

  __
(\   .-.   .-.   /_)
 \\_/smb://_//^\\_//^\\_//
  ``   ``   ``

learn more about them here: 
www.emmasherratt.com/caecilianshttp://www.emmasherratt.com/caecilians






--
Dr. Mauro J. Cavalcanti
E-mail: mauro...@gmail.commailto:mauro...@gmail.com
Web: http://sites.google.com/site/maurobio

--
MORPHMET may be accessed via its webpage at 
http://www.morphometrics.orghttp://www.morphometrics.org/

To unsubscribe from this group and stop receiving emails from it, send an email 
to 
morphmet+unsubscr...@morphometrics.orgmailto:morphmet+unsubscr...@morphometrics.org.

-- 
MORPHMET may be accessed via its webpage at http://www.morphometrics.org

To unsubscribe from this group and stop receiving emails from it, send an email 
to morphmet+unsubscr...@morphometrics.org.


[MORPHMET] Article link

2015-01-13 Thread Collyer, Michael
Here is a direct link for the article Dean mentioned.

 http://onlinelibrary.wiley.com/doi/10./evo.12596/pdf


Michael Collyer

Assistant Professor
Department of Biology
Western Kentucky University
1906 College Heights Blvd. #11080
Bowling Green, KY 42101-1080
Phone: 270-745-8765; Fax: 270-745-6856
Email: michael.coll...@wku.edumailto:michael.coll...@wku.edu

On Jan 13, 2015, at 3:09 PM, Adams, Dean [EEOBS] 
dcad...@iastate.edumailto:dcad...@iastate.edu wrote:

Colleagues,

I want to alert your attention to a new article on-line at Evolution (Adams and 
Collyer 2015: doi:10./evo.12596). In it we compare two approaches for 
performing phylogenetic regression of high-dimensional shape data (one based on 
PICs and another based on PGLS). We show that although the two methods produce 
the same test statistics, the permutation procedures commonly employed with the 
methods can produce largely divergent statistical results.  We demonstrate that 
randomization tests using PICs have unacceptably high type I error rates, and 
can lead to incorrect statistical and biological inferences. We then discuss 
the statistical reasons for this, explain why the permutation method 
implemented in the PGLS-based procedure leads to correct statistical and 
biological inferences, and explain how the permutation procedure for PICs can 
be adjusted to provide appropriate results.

Best,

Dean

Dr. Dean C. Adams
Professor
Department of Ecology, Evolution, and Organismal Biology
   Department of Statistics
Iowa State University
www.public.iastate.edu/~dcadams/http://www.public.iastate.edu/~dcadams/
phone: 515-294-3834


--
MORPHMET may be accessed via its webpage at 
http://www.morphometrics.orghttp://www.morphometrics.org/

To unsubscribe from this group and stop receiving emails from it, send an email 
to 
morphmet+unsubscr...@morphometrics.orgmailto:morphmet+unsubscr...@morphometrics.org.

-- 
MORPHMET may be accessed via its webpage at http://www.morphometrics.org

To unsubscribe from this group and stop receiving emails from it, send an email 
to morphmet+unsubscr...@morphometrics.org.


Re: [MORPHMET] Geomorph gpagen and centroid size

2014-12-05 Thread Collyer, Michael
Hi Michelle,

One problem might be misinterpreting what R displays when you use a function 
rather than what R might save as an object if you create an object based on the 
function.

For example, you could input the following

gpagen(mylandmarks, curves = mycurves, PrinAxes = T)

and R would return presumably return the landmarks and centroid sizes… up to a 
point where it might stop the display because of lots of values.  Alternative, 
and preferably (and maybe what you did, but you did not specify), if you input

mygpa - gpagen(mylandmarks, curves = mycurves, PrinAxes = T)

Then R would return nothing, but it should list your Csize if you ask it to, 
i.e.,

mygpa$Csize

I’m not sure what you mean by similar unsatisfactory results”.  Unsatisfactory 
because the module produces no results or because it produces results that are 
equally unsatisfying?

If you want a DIY approach, you can use mshape() to get the consensus 
configuration, subtract this from your landmarks, square the residuals, sum 
them by configuration and take the square root of the sum, by configuration.

Cheers -Mike

Michael Collyer

Assistant Professor
Department of Biology
Western Kentucky University
1906 College Heights Blvd. #11080
Bowling Green, KY 42101-1080
Phone: 270-745-8765; Fax: 270-745-6856
Email: michael.coll...@wku.edumailto:michael.coll...@wku.edu

On Dec 4, 2014, at 5:31 PM, Michelle Singleton 
mangab...@gmail.commailto:mangab...@gmail.com wrote:


Hello All,

I am having trouble with the gpagen  module in Adam et al.'s Gemorph package, 
and I am hoping someone here may have encountered the same problem or have some 
insight into my problem.I am applying gpagen to execute GPA with sliding 
surface semilandmarks (bending energy criterion). I am running the most recent 
versions of both R and Geomorph.

According to the documentation, gpagen should return a list comprising 1) 
$coords: the aligned coordinate matrix and  2)  $Csize: a vector of centroid 
sizes. Instead, it is returning aligned, slid configurations in the same 3D 
array format (p, k, n) as the infile (generated using readland.nts) but no 
centroid size vector.

I have compared the pre- and post-slide configurations to confirm that sliding 
is occurring. I have tried running the csize module separately and gotten 
similar unsatisfactory results. Can anyone explain why I am getting partial 
output or recommend a fix or workaround?

Many, many thanks,

Michelle Singleton
msi...@midwestern.edumailto:msi...@midwestern.edu




--
MORPHMET may be accessed via its webpage at 
http://www.morphometrics.orghttp://www.morphometrics.org/

To unsubscribe from this group and stop receiving emails from it, send an email 
to 
morphmet+unsubscr...@morphometrics.orgmailto:morphmet+unsubscr...@morphometrics.org.

-- 
MORPHMET may be accessed via its webpage at http://www.morphometrics.org

To unsubscribe from this group and stop receiving emails from it, send an email 
to morphmet+unsubscr...@morphometrics.org.