-------- Original Message -------- Subject: Re: MorphoJ regression scores in R Date: Wed, 29 Feb 2012 06:46:13 -0500 From: Chris Klingenberg <c...@manchester.ac.uk> Reply-To: c...@manchester.ac.uk Organization: University of Manchester To: morphmet@morphometrics.org Dear Paolo The model as stated in the paper and your posting is assuming centred data. For shapes, this is normally so automatically (tangent coordinates usually have the origin at the mean shape). But for the other variables, this may not be the case. If you ensure that both the x and y matrices contain mean-centred variables, it should work. Best wishes, Chris On 2/27/2012 5:24 PM, morphmet wrote:
-------- Original Message -------- Subject: MorphoJ regression scores in R Date: Mon, 27 Feb 2012 11:55:57 -0500 From: ppi...@uniroma3.it To: morphmet@morphometrics.org CC: morphmet@morphometrics.org Dear all, I'm trying to translate in R the procedure implemented in MorphoJ when performing a multivariate regression in order to extraxct what MorphoJ calls "regression scores" vector. As described in Drake and Klingenberg (2008), and in MorphoJ help, given the regression equation *y* = *xB* + *e*, where *y* is the random vector of dependent variables (usually shape), *x* is the random vector of independent variables, *B* is the matrix of regression coefficients, and *e* is the random vector of error effects. A new variable /s_i / can be defined as /s_i / = *yb*/_i /^T (*b*/_i /^T *b*/_i /)^-0.5 , where *b*/_i / is the regression vector for the /i/-th independent variable (/x_i /) and shape. This is simply a projection of the vector *y* onto the direction of the regression vector *b*/_i /. In the context of a regession of a shape vector on one or more independent variables, the regression score /s_i / can be interpreted as the shape variable that is most strongly associated with the /i/-th independent variable. In R, given: 1) a lm() object 2) y: my dependent variables matrix I defined: mat.regcoef<-t(as.matrix(lm$coefficients[2,])) ## I transpose now it because it is in form of vector NOT of matrix regscores<-(y%*%t(mat.regcoef))%*%(mat.regcoef%*%t(mat.regcoef))^-0.5 but ...when I compare these scores with those extracted by MorphoJ I do not found an exact identity. And I should do....... Does anyone have an idea on how to fix the formula? Thanks in advance Paolo
-- *************************************************************** Christian Peter Klingenberg Faculty of Life Sciences The University of Manchester Michael Smith Building Oxford Road Manchester M13 9PT United Kingdom Telephone: +44 161 275 3899 Fax: +44 161 275 5082 E-mail: c...@manchester.ac.uk Web: http://www.flywings.org.uk Skype: chris_klingenberg ***************************************************************