search for: goldstandard

Displaying 7 results from an estimated 7 matches for "goldstandard".

2007 Aug 10
1
[Fwd: Re: How to apply functions over rows of multiple matrices]
...instead of posting to List directly] [...] > Perhaps what you really intend is to > take the average over those elements in each row of the first matrix which correspond to 1's in the second in the corresponding > row of the second. In that case its just: > > rowSums(newtest * goldstandard) / rowSums(goldstandard) > Thank you for clearing my thoughts about the particular example. My question was a bit more general though, as I have different functions which are applied row-wise to multiple matrices. An example that sets all values of a row of matrix A to NA after the first occurr...
2007 Aug 09
1
How to apply functions over rows of multiple matrices
...plying 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 the indices? Best wishes Johannes
2011 Jun 01
1
Function to save plots
Hello, I'm using ROCR to plot ROC Curves and I want to automate the saving of plots into PNG files using a custom function. My data frames are named like test1, test2, test3. Each data frame has three variables: method1, method2, goldstandard. Right now, for each plot I have to run: png('test1_method1.png') plot(performance(prediction(test1$method1, test1$goldstandard), "tpr", "fpr")) dev.off() Here is the function I tried to create but I failed: roc <- function(arg1, arg2){ png(paste(arg1, arg2, &qu...
2010 Nov 29
1
selecting only corresponding categories from a confusion matrix
...0 1010 4 0 0 3 0 1011 1 0 1 0 2 11 0 0 3 3 1 110 1 0 0 0 0 1100 2 0 0 0 0 1110 1 0 0 0 0 The first column represents the categories found among observers, the top row represents the categories found by the reference ("goldstandard"). I am looking for a way (general algorithm) to extract a data.frame with only the corresponding categories among observers and reference from the above confusion matrix. "Corresponding" means in this case, that a category has been chosen by both: observers and reference. In this ex...
2008 Sep 06
3
how to address last and all but last column in dataframe
...hat I can easily create a confusion matrix out of this data using the following commands: pairs<-data.frame(pred=factor(unlist(input[2:21])),ref=factor(input[,22])) pred<-pairs$pred ref <- pairs$ref library (caret) confusionMatrix(pred, ref, positive=1) - where column 21 is the reference/goldstandard. My problem is now, that I analyse data.frames with an unknown count of columns. So to get rid of the first and last column for the "pred" variable and to select the last column for the "ref" variable, I have to look at the data.frame before doing the above commands to set the...
2011 Aug 16
1
how to sort the levels of a table
Dear colleagues, I have really heavy problems in sorting the results of a table according to certain features of the levels in the table. Prerequisites: It all starts with a fairly simple data set, which stores observations of 21 observers (horizontally from 1 to 21; 21 is reference/goldstandard) who diagnosed 42 videos (vertically from 1 to 42). See dump of R-object "input" below in case you are interested in the original data. Each observation is a series of 1 and 0 (different length!) which was obtained by concatenating answers of a multiple choice questionaire. I created a c...
2007 Aug 11
0
DOE and interaction plot general question
...do it (although I am not sure its better than the > index approach): > > row.apply <- function(f, a, b) > t(mapply(f, as.data.frame(t(a)), as.data.frame(t(b)))) > > 3. The code for the example in this post could be simplified to: > > first.1 <- apply(cbind(goldstandard, 1), 1, which.max) > ifelse(col(newtest) > first.1, NA, newtest) > > 4. given that both examples did not inherently need row by row operations > I wonder if that is the wrong generalization in the first place? > > > On 8/10/07, Johannes H?sing <johannes@huesing.nam...