[Forensim-help] r122 - in pkg: R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Jul 23 18:09:45 CEST 2009
Author: hindahaned
Date: 2009-07-23 18:09:41 +0200 (Thu, 23 Jul 2009)
New Revision: 122
Modified:
pkg/R/AuxFunc.R
pkg/R/likestim.R
pkg/man/likestim.loc.Rd
Log:
Modified: pkg/R/AuxFunc.R
===================================================================
--- pkg/R/AuxFunc.R 2009-07-23 15:35:17 UTC (rev 121)
+++ pkg/R/AuxFunc.R 2009-07-23 16:09:41 UTC (rev 122)
@@ -6,8 +6,8 @@
# returns the position and the value of the maximum of a vector
findmax<-function(vec)
- {
- res0<-matrix(0,nrow=2,ncol=1)
+{
+ res0<-matrix(0,nrow=1,ncol=2)
#res0<-data.frame(res0)
if(all(vec==0))
{
@@ -15,22 +15,22 @@
maxval<-0
}
else{
- xmax<-which(vec==max(vec))#car discret...
- maxval<-vec[xmax]
+ xmax<-which(vec==max(vec))
+ maxval<-(vec[xmax])
}
#print(round(xmax))
res0[1,1]<-xmax
- res0[2,1]<-maxval
+ res0[1,2]<-maxval
- rownames(res0)<-c('max','maxval')
- colnames(res0)<-names(vec)
- return(res0)
- }
+ colnames(res0)<-c('max','maxval')
+ rownames(res0)<-names(vec)
+ return((res0))
+}
-#takes a matrix or a data frame in format of the Journal of Forenis Sciences for genetic data, and returns a list of markers with their allele frequencies,
+#takes a matrix or a data frame in the format of the Journal of Forenis Sciences for genetic data, and returns a list of markers with their allele frequencies,
#skips the NA markers
naomitab<-
function(tab)
Modified: pkg/R/likestim.R
===================================================================
--- pkg/R/likestim.R 2009-07-23 15:35:17 UTC (rev 121)
+++ pkg/R/likestim.R 2009-07-23 16:09:41 UTC (rev 122)
@@ -20,7 +20,7 @@
#the maximum is searched in the discrete interval : 1: 6, more contributors is unlikely ?
locres <- as.matrix(apply(sapply(1:6,function(i) lik.loc(i,mix,freq,refpop,theta, loc)),1,findmax))
rownames(locres) <- c('max','maxval')
- return(locres)
+ return(t(locres))
}
#likestm.loc(mix1,freq1)
Modified: pkg/man/likestim.loc.Rd
===================================================================
--- pkg/man/likestim.loc.Rd 2009-07-23 15:35:17 UTC (rev 121)
+++ pkg/man/likestim.loc.Rd 2009-07-23 16:09:41 UTC (rev 122)
@@ -25,8 +25,9 @@
}
\value{
-A matrix of dimension 2 x \code{loc}. The first row, \code{max}, gives the maximum likelihood estimation
-of the number of contributors for each locus in column. The second row, \code{maxvalue}, gives the corresponding likelihood value.
+A matrix of dimension \code{loc} x 2. The first colum, \code{max}, gives the maximum likelihood estimation
+of the number of contributors for each locus in row. The second column, \code{maxvalue},
+gives the corresponding likelihood value.
}
More information about the Forensim-commits
mailing list