[R] cluster analysis error - mclust package

2012-11-26 Thread KitKat
I am following instructions online for cluster analysis using the mclust
package, and keep getting errors.
http://www.statmethods.net/advstats/cluster.html

These are the instructions (there is no sample dataset unfortunately):
# Model Based Clustering
library(mclust)
fit - Mclust(mydata)
plot(fit, mydata) # plot results 
print(fit) # display the best model 

This is what I did and the error I get:
 library(mclust)
 fit - Mclust(mydat)
 plot(fit, mydat) #plot results
Error in match.arg(what, c(BIC, classification, uncertainty,
density),  : 
  'arg' must be NULL or a character vector

My data is arranged so I have each row representing one individual with 9
values for morphological data. I want to see if they will group into 2
clusters, representing gender. 

I have tried using the instructions from the cran-r website, but they didn't
work either

Any help would be great, thank you



--
View this message in context: 
http://r.789695.n4.nabble.com/cluster-analysis-error-mclust-package-tp4650842.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] cluster analysis in R

2012-11-22 Thread KitKat
These are the errors I've been having. I have been trying 3 different things

1- Mclust:
This is the example I have been following:
# Model Based Clustering
library(mclust)
fit - Mclust(mydata)
plot(fit, mydata) # plot results 
print(fit) # display the best model 
 
What I have done:
 fit - Mclust(mydat)
 plot(fit, mydat) #plot results
Error in match.arg(what, c(BIC, classification, uncertainty,
density),  : 
  'arg' must be NULL or a character vector

2- Mclust using different website (cran-r) instructions
This is the example: 
 mydatMclust - Mclust(mydat)
 summary(mydatMclust)
 summary(mydatMclust, parameters = TRUE)
 plot(mydatMclust)

There are a couple other steps but the plot is the problem. I get two plots,
there should be four. One should be plotting all my individuals but it's
plotting my variables instead. It's also taking a very long time. R script
at this point says: Waiting to confirm page changeā€¦ 

3. Mcclust 
Instructions from cran-r:
data(cls.draw2)
# sample of 500 clusterings from a Bayesian cluster model
tru.class - rep(1:8,each=50)
# the true grouping of the observations
psm2 - comp.psm(cls.draw2)
# posterior similarity matrix
# optimize criteria based on PSM
mbind2 - minbinder(psm2)
mpear2 - maxpear(psm2)
# Relabelling
k - apply(cls.draw2,1, function(cl) length(table(cl)))
max.k - as.numeric(names(table(k))[which.max(table(k))])
relab2 - relabel(cls.draw2[k==max.k,])
# compare clusterings found by different methods with true grouping
arandi(mpear2$cl, tru.class)
arandi(mbind2$cl, tru.class)
arandi(relab2$cl, tru.class)

I called my data: mydat so I changed that where appropriate. I cannot get
past one early step, psm2 - comp.psm(cls.draw2).. the error reads: Error:
could not find function comp.psm

I think I have all appropriate packages installed. I don't know what more to
do on these three errors.  Any help would be great! Thank you




--
View this message in context: 
http://r.789695.n4.nabble.com/cluster-analysis-in-R-tp4649635p4650466.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Bayesian cluster analysis - R functions

2012-11-21 Thread KitKat
I want to try Bayesian cluster analysis. Someone suggested using package
mcclust. Is there a website that says how to install mcclust or another
appropriate Bayesian package? Including the appropriate R functions that I
can follow?

I am trying to get probability of membership for each individual I am trying
to cluster

Thank you!



--
View this message in context: 
http://r.789695.n4.nabble.com/Bayesian-cluster-analysis-R-functions-tp4650337.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] cluster analysis in R

2012-11-21 Thread KitKat
Thank you for replying! 
I made a new post asking if there are any websites or files on how to
download package mclust (or other Bayesian cluster analysis packages) and
the appropriate R functions? Sorry I don't know how this forum works yet



--
View this message in context: 
http://r.789695.n4.nabble.com/cluster-analysis-in-R-tp4649635p4650341.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] cluster analysis in R

2012-11-21 Thread KitKat
Thanks, I have been trying that site and another one
(http://www.statmethods.net/advstats/cluster.html)

I don't know if I should be doing mclust or mcclust, but either way, the
codes are not working. I am following the guidelines online at:
mcclust - http://cran.r-project.org/web/packages/mcclust/mcclust.pdf
mclust - http://cran.r-project.org/

I am relatively new to R, but so far I have been able to figure out dfa,
manova, pca... I cannot get these codes to work, I keep getting various
errors. Are there other resources that have details about what codes to use
or what to do when errors result? I have not found anything else helpful 

Thank you



--
View this message in context: 
http://r.789695.n4.nabble.com/cluster-analysis-in-R-tp4649635p4650397.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] cluster analysis in R

2012-11-15 Thread KitKat
I have two issues. 

1-I am trying to use morphology to identify gender. I have 9 variables, both
continuous and categorical. I was using two-step cluster analysis in SPSS
because two-step could deal with different types of variables. But the
output tells me that an animal is in cluster 1 or 2, it does not give me a
probability (ex. 0.70 cluster 2).  I also did not want to specify that I
want two clusters, I wanted to see if analysis would naturally give me two
clusters. These were all advantages to using SPSS but now I'm having
trouble.

Does cluster analysis in R give probabilities?
Which type of cluster analysis in R is best to use? I did not think
hierarchical analysis was a great choice, but maybe I'm wrong. I don't want
to create the average variable, I want the analysis to do it on its own. 
I'm also new to R so would have to figure out the right codes to enter, etc.

2-I was also told to analyze each variable on its own before including it in
cluster analysis. I had first included them all then teased out which ones
were not important, but now have been asked to do the reverse. I cannot do
cluster analysis on one variable -for example, one variable is either
present or absent on an individual so of course cluster analysis gives me
two clusters, one representing present and one representing absent. I was
told to use regression, but how can regression also not give the same
result? I feel like it would give me a line connecting a bunch of 0s to 1s.
I don't know what to use, or if I can analyze each variable like this before
putting them into cluster analysis. I ultimately want to only use the
smallest number of variables necessary to identify gender. 

I have tried reading manuals etc and talking to people at my school, but
nothing has helped. If anyone has any insight, that would be much
appreciated
Thank you!



--
View this message in context: 
http://r.789695.n4.nabble.com/cluster-analysis-in-R-tp4649635.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.