help on statistics and code

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

help on statistics and code

david v-2
Hi,
I need some advise on statistics. I have written the code below. What i'm
trying to do here is that i read 1000 distance matrices derived from the
same original data set. Afterwards I wan to create a consensus matix out of
those 1000 distance matrices to see the relevance of the original matrix.
Is that correct ?? should i be doing something else ?

library(stats)
library(ade4)
library(cluster)
library(ape)

nb_runs <- 1000
first_matrix=TRUE

#Reading 1000 distance matrices
for (i in 1:nb_runs)
{
infile="input_matrix"
infile<-paste(infile,i,sep="_")
cat("\nReading ",infile,"")
data<-read.table(infile,header=FALSE,sep="\t",row.names=1)


#
# First matrix we read
if (first_matrix)
{
first_matrix=FALSE
Mdist=dist.binary(data,method=1,diag=TRUE)
}
else {
#the other 999 matrices
dis<-dist.binary(data,method=1,diag=TRUE)
Mdist <- Mdist+dis
}
#Get the consensus matrix based on 1000 matrices
Matallp<-(Mdist/nb_runs )
clust<-hclust(Matall)
...
Is that correct ?? the code works properly.

Thanks for your help

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html