<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.23543">
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV align=justify><FONT color=#0000ff face=Arial><STRONG>Muito obrigado! Parece
que resolveu o problema, vamos tentar verificar o embasamento teórico por
detrás.</STRONG></FONT></DIV>
<BLOCKQUOTE
style="BORDER-LEFT: #000000 2px solid; PADDING-LEFT: 5px; PADDING-RIGHT: 0px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px">
<DIV>Mauro, boa tarde!</DIV>
<DIV dir=ltr>
<DIV><FONT size=2 face=Arial></FONT><BR></DIV>
<DIV>Trabalhei um pouco em cima do seu código e cheguei a plotar as elipses,
mas precisaria revisar o conteúdo de multivariada pra saber se o procedimento
está correto. </DIV>
<DIV><FONT size=2 face=Arial></FONT><BR></DIV>
<DIV>De qualquer modo, posto o código para que você veja se é possível
aproveitar algo.</DIV>
<DIV><FONT size=2 face=Arial></FONT><BR></DIV>
<DIV><FONT face="courier new, monospace">### <code r></FONT></DIV>
<DIV><FONT face="courier new, monospace">dURL <- ('<A
href="https://www.dropbox.com/s/405ggda0h6scnie/marajoara320amostras.txt">https://www.dropbox.com/s/405ggda0h6scnie/marajoara320amostras.txt</A>')</FONT></DIV>
<DIV><FONT face="courier new, monospace">dURL2 <- ('<A
href="https://dl.dropboxusercontent.com/s/405ggda0h6scnie/marajoara320amostras.txt?token_hash=AAFD9qRCKF1VECx1_j7-gf0ab93bFdJ2CojO4J_WYIh83w">https://dl.dropboxusercontent.com/s/405ggda0h6scnie/marajoara320amostras.txt?token_hash=AAFD9qRCKF1VECx1_j7-gf0ab93bFdJ2CojO4J_WYIh83w</A>')</FONT></DIV>
<DIV><FONT face="courier new, monospace">dName <- basename(dURL);
dName</FONT></DIV>
<DIV><FONT face="courier new, monospace">download.file(dURL2, dName,
mode='wb')</FONT></DIV>
<DIV><FONT face="courier new, monospace">file.show(dName)</FONT></DIV>
<DIV><FONT face="courier new, monospace"><BR></FONT></DIV>
<DIV><FONT face="courier new, monospace">maraOri <-
read.table('marajoara320amostras.txt', head=FALSE); head(maraOri)</FONT></DIV>
<DIV><FONT face="courier new, monospace">maraNorm <-
data.frame(scale(maraOri)); head(maraNorm)</FONT></DIV>
<DIV><FONT face="courier new, monospace"></FONT> </DIV>
<DIV><FONT face="courier new, monospace">### Cluster</FONT></DIV>
<DIV><FONT face="courier new, monospace">maraNorm.h <-
hclust(dist(maraNorm)^2, method="ward")</FONT></DIV>
<DIV><FONT face="courier new, monospace">maraGroups <-
cutree(maraNorm.h, 3); maraGroups</FONT></DIV>
<DIV><FONT face="courier new, monospace">maraInitial <-
aggregate(maraNorm, by=list(maraGroups), mean)[,-1]; maraInitial</FONT></DIV>
<DIV><FONT face="courier new, monospace">maraNorm.km1 <-
kmeans(maraNorm,maraInitial)</FONT></DIV>
<DIV><FONT face="courier new, monospace">plot(maraNorm.h,
main="marajoara320amostras")</FONT></DIV>
<DIV><FONT face="courier new, monospace"><BR></FONT></DIV>
<DIV><FONT face="courier new, monospace">### PCA</FONT></DIV>
<DIV><FONT face="courier new, monospace">maraNorm.pca <-
princomp(maraNorm)</FONT></DIV>
<DIV><FONT face="courier new, monospace">maraNorm.px <-
predict(maraNorm.pca)</FONT></DIV>
<DIV><FONT face="courier new, monospace"><BR></FONT></DIV>
<DIV><FONT face="courier new, monospace">library(MASS)</FONT></DIV>
<DIV><FONT
face="courier new, monospace">eqscplot(maraNorm.px[,1:2],type="n",xlab="componente
1",ylab="componente 2")</FONT></DIV>
<DIV><FONT
face="courier new, monospace">text(maraNorm.px[,1:2],labels=as.character(maraNorm.km1$cluster),col=as.numeric(maraNorm.km1$cluster),cex=.5)</FONT></DIV>
<DIV><FONT
face="courier new, monospace">title("marajoara320amostras")</FONT></DIV>
<DIV><FONT face="courier new, monospace">#identify(maraNorm.px[,1:2]) #
identificar amostras no gráfico de PCA</FONT></DIV>
<DIV><FONT face="courier new, monospace">library(ellipse)</FONT></DIV>
<DIV><FONT face="courier new, monospace">tmp <-
split(data.frame(maraNorm.px[,1:2]), maraGroups)</FONT></DIV>
<DIV><FONT face="courier new, monospace">lapply(tmp, cor)</FONT></DIV>
<DIV><FONT face="courier new, monospace">lapply(tmp, function(x)
lines(ellipse(cor(x), level=0.95, centre=c(mean(x[,1]),mean(x[,2]))),
lty=2))</FONT></DIV>
<DIV><FONT face="courier new, monospace"><BR></FONT></DIV>
<DIV><FONT face="courier new, monospace">### </code></FONT></DIV>
<DIV class=gmail_extra><FONT size=2 face=Arial></FONT><BR clear=all>
<DIV>
<DIV dir=ltr>Éder Comunello <<A href="mailto:comunello.eder@gmail.com"
target=_blank>c</A><A href="mailto:omunello.eder@gmail.com"
target=_blank>omunello.eder@gmail.com</A>> <BR>Dourados, MS - [22 16.5'S,
54 49'W]<BR></DIV></DIV><BR></DIV></DIV></BLOCKQUOTE></BODY></HTML>