[R] help on statistics and code

david v danova_fr at hotmail.com
Thu Jan 19 17:32:10 CET 2006


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




More information about the R-help mailing list