search for: cutoff

Displaying 20 results from an estimated 515 matches for "cutoff".

2023 Oct 16
1
Create new data frame with conditional sums
If one makes the reasonable assumption that Pct is much larger than Cutoff, sorting Cutoff is the expensive part e.g O(nlog2(n) for Quicksort (n = length Cutoff). I believe looping is O(n^2). Jeff's approach using findInterval may be faster. Of course implementation details matter. -- Bert On Mon, Oct 16, 2023 at 4:41?AM Leonard Mada <leo.mada at syonic.eu> w...
2009 Mar 27
1
ROCR package finding maximum accuracy and optimal cutoff point
If we use the ROCR package to find the accuracy of a classifier pred <- prediction(svm.pred, testset[,2]) perf.acc <- performance(pred,"acc") Do we?find the maximum accuracy?as follows?(is there a simplier way?): > max(perf.acc at x.values[[1]]) Then to find the cutoff point that maximizes the accuracy?do we do the following?(is there a simpler way): > cutoff.list <- unlist(perf.acc at x.values[[1]]) > cutoff.list[which.max(perf.acc at y.values[[1]])] If the above is correct how is it possible to find the average false positive and negative rates? from...
2023 Oct 16
1
Create new data frame with conditional sums
Dear Jason, The code could look something like: dummyData = data.frame(Tract=seq(1, 10, by=1), ?? ?Pct = c(0.05,0.03,0.01,0.12,0.21,0.04,0.07,0.09,0.06,0.03), ?? ?Totpop = c(4000,3500,4500,4100,3900,4250,5100,4700,4950,4800)) # Define the cutoffs # - allow for duplicate entries; by = 0.03; # by = 0.01; cutoffs <- seq(0, 0.20, by = by) # Create a new column with cutoffs dummyData$Cutoff <- cut(dummyData$Pct, breaks = cutoffs, ?? ?labels = cutoffs[-1], ordered_result = TRUE) # Sort data # - we could actually order only the columns:...
2009 Jul 23
1
ROCR - confidence interval for Sens and Spec
Dear List,   I am new to ROC analysis and the package ROCR. I want to compute the confidence intervals of sensitivity and specificity for a given cutoff value. I have used the following to calculate sensitivity and specificity:   data(ROCR.simple) pred <- prediction(ROCR.simple$predictions, ROCR.simple$labels)   se.sp <- function (cutoff, performance) {     sens <- performance(pred,"sens")     spec <- performance(pred,"...
2023 Oct 15
2
Create new data frame with conditional sums
...thing wrong with using a loop to solve > this problem, but it's generally a good idea to pre-allocate space for > the result rather than build it up one value at a time, which may cause > unnecessary copying of the object. > > Here are three solutions: > > f1 <- function(Cutoff, Pct, Totpop){ > Pop <- numeric(0) > for (i in seq_along(Cutoff)) > Pop[i] <- sum(Totpop[Pct >= Cutoff[i]]) > cbind(Cutoff, Pop) > } > > f2 <- function(Cutoff, Pct, Totpop){ > Pop <- numeric(length(Cutoff)) > for (i in seq_along(Cutoff))...
2023 Oct 14
1
Create new data frame with conditional sums
...'t think that there's anything wrong with using a loop to solve this problem, but it's generally a good idea to pre-allocate space for the result rather than build it up one value at a time, which may cause unnecessary copying of the object. Here are three solutions: f1 <- function(Cutoff, Pct, Totpop){ Pop <- numeric(0) for (i in seq_along(Cutoff)) Pop[i] <- sum(Totpop[Pct >= Cutoff[i]]) cbind(Cutoff, Pop) } f2 <- function(Cutoff, Pct, Totpop){ Pop <- numeric(length(Cutoff)) for (i in seq_along(Cutoff)) Pop[i] <- sum(Totpop[Pct >= Cuto...
2009 Aug 17
1
how to pass more than one argument to the function called by lapply?
Dear R helpers: I wonder how to pass more than one argument to the function called by lapply. For example, #R code below --------------------------- indf <- data.frame(id=I(c('a','b')),y=c(1,10)) #I want to add an addition argument cutoff into the function called by lapply. outside.fun <- function(indf, cutoff) { unlist(lapply(split(indf, indf[,'id']), function(.x, cutoff) {.x[,'y'] < cutoff} )) } #but the next line does not work outside.fun(indf,3) #as you expected, hard code cutoff works as below, but I do...
2023 Oct 14
2
Create new data frame with conditional sums
Well, here's one way to do it: (dat is your example data frame) Cutoff <- seq(0, .15, .01) Pop <- with(dat, sapply(Cutoff, \(p)sum(Totpop[Pct >= p]))) I think there must be a more efficient way to do it with cumsum(), though. Cheers, Bert On Sat, Oct 14, 2023 at 12:53?AM Jason Stout, M.D. <jason.stout at duke.edu> wrote: > > This seems like it...
2006 Jul 24
1
deparse - width.cutoff
I have a question about "deparse" function in R What is the reason that "deparse" use an argument like "width.cutoff" ? Why the maximum cutoff is 500? I was manipulating an R formula and used "deparse". Since the length of user's formula was greater then 500, my code didnt work. thanks Johan johan Faux <johanfaux@yahoo.com> wrote: I have a question about "deparse" function in...
2014 Apr 15
6
[PATCH 0/3] misc. cleanup
Hello, some misc. cleanup patches for speexdsp, nothing big I'm not sure about how to submit patches, so this is a test balloon :) ultimately, I'd like to fix the FIXED_POINT issue, see http://lists.xiph.org/pipermail/speex-dev/2013-December/008465.html currently, I think the only way to find out how speexdsp has been compiled is to resample some bytes and observe the output; which is
2023 Oct 15
1
Create new data frame with conditional sums
Dear Jason, I do not think that the solution based on aggregate offered by GPT was correct. That quasi-solution only aggregates for every individual level. As I understand, you want the cumulative sum. The idea was proposed by Bert; you need only to sort first based on the cutoff (e.g. using an ordered factor). And then only extract the last value for each level. If Pct is unique, than you can skip this last step and use directly the cumsum (but on the sorted data set). Alternatives: see the solutions with loops or with sapply. Sincerely, Leonard
2010 Jun 30
1
vlmc - "In vlmc(traffic.clusters.stationary, cutoff = i) : alphabet with >1-letter strings; trying to abbreviate"
...of some clustering). When I run the following command (synthetic data to facilitate self-contained example) I get the following warning: ("alphabet with >1-letter strings; trying to abbreviate") +++ START+++ > library(VLMC) > a <- floor(runif(1000,0,11)) > vc <- vlmc(a,cutoff=5) Warning message: In vlmc(a, cutoff = 5) : alphabet with >1-letter strings; trying to abbreviate > vc 'vlmc' a Variable Length Markov Chain; alphabet 'abcdefghijk', |alphabet| = 11, n = 1000. Call: vlmc(dts = a, cutoff.prune = 5) -> extensions (= $size ) : ord.MC...
2011 Feb 14
1
Optimal Y>=q cutoff after logistic regression
...c. But I want to do it anyway. I'd like to include as a measure of fit % of observations correctly classified because it's measured in units that non-statisticians can understand more easily than area under the ROC curve, Dxy, etc. Am I right that there is an optimal Y>=q probability cutoff, at which the True Positive Rate is high and the False Positive Rate is low? Visually, it would be the elbow in the ROC curve, right? My reasoning is that even if you had a near-perfect model, you could set a stupidly low (high) cutoff and have a higher false positive (negative) rate than would be...
1997 Sep 08
0
R-alpha: deparse bug
The deparse function has an argument "width.cutoff" which allows you to set the width at which line breaking is attempted. However, setting this argument _permanently_ changes the line break width. Looking at the source code ($RHOME/src/main/deparse.c), I see that the width.cutoff argument sets the static variable "cutoff". Althou...
2023 Oct 13
1
Create new data frame with conditional sums
...4500 4 0.12 4100 5 0.21 3900 6 0.04 4250 7 0.07 5100 8 0.09 4700 9 0.06 4950 10 0.03 4800 And I want to end up with a data frame with two columns, a "Cutoff" column that is a simple sequence of equally spaced cutoffs (let's say in this case from 0-0.15 by 0.01) and a "Pop" column which equals the sum of "Totpop" in the prior data frame in which "Pct" is greater than or equal to "cutoff." So in this toy...
2005 Mar 15
3
Voice getting cutoff
Guys.. I just noticed that my grandstream handytone 286 ata are having problems with voice cutoffs... We can listen to the person on the zap channel (x100p cards) without problems but they sometimes listen to us with cutoffs.. like "He ...lo..... ow...r.. you" and it comes and goes.. this doesnt happen all the time but often enough. Any ideas what might be happening or what do I nee...
2014 Apr 15
0
[PATCH 2/3] Use fabsf() instead of fabs() since we have floats, not double
...((x) < -32767.5f ? -32768 : ((x) > 32766.5f ? 32767 : floor(.5+(x)))) +#define WORD2INT(x) ((x) < -32767.5f ? -32768 : ((x) > 32766.5f ? 32767 : floorf(.5+(x)))) #endif #define IMAX(a,b) ((a) > (b) ? (a) : (b)) @@ -273,12 +273,12 @@ static spx_word16_t sinc(float cutoff, float x, int N, struct FuncDef *window_fu { /*fprintf (stderr, "%f ", x);*/ float xx = x * cutoff; - if (fabs(x)<1e-6f) + if (fabsf(x)<1e-6f) return WORD2INT(32768.*cutoff); - else if (fabs(x) > .5f*N) + else if (fabsf(x) > .5f*N) return 0;...
2008 May 17
1
Correlated Columns in data frame
...previous message to this list to which I do not get any reply. Dear all, For removing correlated columns in a data frame,df. I found a code written in R in the page http://cheminfo.informatics.indiana.edu/~rguha/code/R/ of Mr.Rajarshi Guha. The code is ################# r2test <- function(df, cutoff=0.8) { if (cutoff > 1 || cutoff <= 0) { stop(" 0 <= cutoff < 1") } if (!is.matrix(d) && !is.data.frame(d)) { stop("Must supply a data.frame or matrix") } r2cut = sqrt(cutoff); cormat <- cor(d); bad.idx <- which(abs(cormat)>r2cut...
2014 Apr 15
2
[PATCH 2/3] Use fabsf() instead of fabs() since we have floats, not double
....5f ? -32768 : ((x) > 32766.5f ? 32767 : > floor(.5+(x)))) > +#define WORD2INT(x) ((x) < -32767.5f ? -32768 : ((x) > 32766.5f ? 32767 : > floorf(.5+(x)))) > #endif > > #define IMAX(a,b) ((a) > (b) ? (a) : (b)) > @@ -273,12 +273,12 @@ static spx_word16_t sinc(float cutoff, float x, int > N, struct FuncDef *window_fu > { > /*fprintf (stderr, "%f ", x);*/ > float xx = x * cutoff; > - if (fabs(x)<1e-6f) > + if (fabsf(x)<1e-6f) > return WORD2INT(32768.*cutoff); > - else if (fabs(x) > .5f*N) > + else i...
2008 Mar 04
3
creating a matrix subset based on a threshold cutoff
Hi, I have a table of x rows and y columns. The table is huge and so i'd like to create a subset of the data containing rows where any of the y values are below a threshold, say 1e-4. Is there a simple way of doing this in R? thanks Rich