search for: numtest

Displaying 6 results from an estimated 6 matches for "numtest".

Did you mean: numtests
2007 Aug 09
1
How to apply functions over rows of multiple matrices
...e are a couple of *applys (including mApply in Hmisc) but I haven't found out how to do it straightforward. Applying to row indices works, but looks like a poor hack to me: sens <- function(test, gold) { if (any(gold==1)) { sum(test[which(gold==1)]/sum(which(gold==1))) } else NA } numtest <- 6 numsubj <- 20 newtest <- array(rbinom(numtest*numsubj, 1, .5), dim=c(numsubj, numtest)) goldstandard <- array(rbinom(numtest*numsubj, 1, .5), dim=c(numsubj, numtest)) t(sapply(1:nrow(newtest), function(i) { sens(newtest[i,], goldstandard[i,])})) Is there any shortcut...
2011 Sep 07
4
suggestion for proportions
Hi, I am wondering if anyone can suggest how to test the equality of 2 proportions. The caveat here is that the 2 proportions were calculated from the same number of samples using 2 different tests. So essentially we are comparing 2 accuracy rates from same, say 100, samples. I think this is like a paired test, but don't know if really we need to consider the "paired" nature of the
2007 Aug 10
1
[Fwd: Re: How to apply functions over rows of multiple matrices]
...be of same length!") } else if(any(testvec, na.rm=TRUE)) { applvec[min(which(testvec)) : length(applvec)] <- NA } applvec } fillafter <- function(applvec, testvec=NULL) { if (is.null(testvec)) testvec <- applvec fillfrom(applvec, c(FALSE, testvec[-length(testvec)])) } numtest <- 6 numsubj <- 20 newtest <- array(rbinom(numtest*numsubj, 1, .5), dim=c(numsubj, numtest)) goldstandard <- array(rbinom(numtest*numsubj, 1, .5), dim=c(numsubj, numtest)) newtest.NA <- t(sapply(1:nrow(newtest), function(i) { fillafter(newtest[i,], goldstandard[i,]==1)}))...
2010 Sep 20
3
Depletion of small p values upon iterative testing of identical normal distributions
...er. Is there any reason, perhaps to do with random number generation in R or the nature of the normal distribution simulated by the rnorm function that could explain this depletion? Here are two key parts of my code to show what functions I'm working with: #Calculating the p values while(i<numtests){ Group1<-rnorm(6,-0.0065,0.0837) Group2<-rnorm(6,-0.0065,0.0837) PV<-t.test(Group1,Group2)$p.value pscoresvector<-c(PV,pscoresvector) i<-i+1 } #Binning the results freqtbl1<-binning(pscoresvector,breaks=bins) Thanks in advance for any insights, Andrew [[alternative HTML ver...
2006 Jan 10
1
Find last row (observation) for each combination of variables
...KEY; by A B C; run; I tried using "aggregate" to find the maximum TS for each combination of A/B/C, but it's slow. I also tried "by" but it's also slow. My current (faster) solution is: DF$abc<-paste(DF$A,DF$B,DF$C,sep="") abclist<-unique(DF$ABC) numtest<-length(abclist) maxTS<-rep(0,numtest) for(i in 1:numtest){ maxTS[i]<-max(DF$TS[DF$abc==abclist[i]],na.rm=TRUE) } maxTSdf<-data.frame(device=I(abc),maxTS=maxTS ) DF<-merge(DF,maxTSdf,by="abc",all.x=TRUE) DF<-Df[DF$TS==DF$maxTS,,drop=TRUE] DF$maxTS<-NULL This...
2007 Aug 11
0
DOE and interaction plot general question
...ec)) : length(applvec)] <- NA > > } > > applvec > > } > > > > fillafter <- function(applvec, testvec=NULL) { > > if (is.null(testvec)) testvec <- applvec > > fillfrom(applvec, c(FALSE, testvec[-length(testvec)])) > > } > > > > numtest <- 6 > > numsubj <- 20 > > > > newtest <- array(rbinom(numtest*numsubj, 1, .5), > > dim=c(numsubj, numtest)) > > goldstandard <- array(rbinom(numtest*numsubj, 1, .5), > > dim=c(numsubj, numtest)) > > > > newtest.NA <- t(sapply(1:n...