Displaying 4 results from an estimated 4 matches for "numsubj".
Did you mean:
nsubj
2007 Aug 09
1
How to apply functions over rows of multiple matrices
...f
*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 to sapply over...
2007 Aug 10
1
[Fwd: Re: How to apply functions over rows of multiple matrices]
...th!")
} 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)}))
My general que...
2009 Jul 20
2
HELP: BRUGS/WinBUGS/RBUGS Response is a combination of random variables
...k("BayesBioMarker.BUGS")
model is syntactically correct
> modelData(paste("BUGS_data.txt",sep=""))
data loaded
> modelCompile(numChains=1)
multiple definitions of node bm[1]
===================================
model
{
for(iter in 1:numSubj){
bmd[iter] ~ dnorm(u[trt[iter]+1],sdbmd.precision);
###############
bm[iter] <- inprod(biomarker[iter,1:4], bta[1:4])
bm[iter] ~ dnorm(bmu[iter], sdbm.precision);
###############
bmu[iter] &l...
2007 Aug 11
0
DOE and interaction plot general question
...t;- 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)...