search for: runmean

Displaying 20 results from an estimated 20 matches for "runmean".

2011 Sep 23
0
(Requested) caTools::runmean Patch
Dear Mr. Tuszynski, I would like to request what I believe would be a beneficial update / patch to the runmean() function in the caTools package. Consider the following R>> x = 1:100 R>> is.integer(x) [1] TRUE R>> library(caTools) R>> head(runmean(x, 5, alg="exact")) [1] 8.487983e-314 1.060998e-313 1.273197e-313 1.697597e-313 2.121996e-313 2.546395e-313 R>> head(run...
2007 Feb 20
1
baseline fitters
...values to zero. But runquantile's computation time proves exceedingly long for my large datasets, particularly if I set the endrule parameter to 'func'. Here is what caTools author Jarek Tuszynski says about relative speeds of various running-window functions: - runmin, runmax, runmean run at O(n) - runmean(..., alg="exact") can have worst case speed of O(n^2) for some small data vectors, but average case is still close to O(n). - runquantile and runmad run at O(n*k) - runmed - related R function runs at O(n*log(k)) The obvious alternative runmin() pe...
2012 Mar 03
1
Sliding Window in R (solved)
...<- mean(data[i:(i + windowSize - 1), ])         elements[i]<-length(i:(i + windowSize - 1))       }   }   return (list(result=out , numberOfElements=elements, windowSize=windowSize )) } do_sliding_for_a_window_duty_cycle_alternative <- function(DataToAnalyse, windowSize) {     result= runmean(rowMeans(DataToAnalyse),windowSize,endrule="trim",alg="C")     return( list(result= result, windowSize=windowSize)) } DataToAnalyse<-matrix(data=round(seq(1:100000000)),nrow=10000,byrow=TRUE) # How much time they need to runmean system.time(a<-do_sliding_for_a_win...
2002 Sep 16
1
Running Median and Mean
...e we adding a lower number? */ if (x[k] > old) {r[k]--;} /* Are we dropping a higher number? */ if (r[k]==R) x[*N] = x[k]; /* If rank=R, this is the median */ } r[0] = a; if (a==R) x[*N] = new; /* Is the new guy the median? */ } } } void runMean(double *m, int *d, int *N) { int i, j, k; double new, *x; for (j=1; j <= d[1]; j++) { /* Loop over columns */ x = m + j*d[0] - 1 - *N; for (i=d[0]; i > *N; i--) { /* x[*N] = m[i,j] */ for (k=0, new=0; k < *N; k++) new...
2005 Jun 17
0
Release of new version of caMassClass package and new package caT ools
...which might be useful to broader group, is much smaller than "caMassClass" and has fewer dependencies. Other changes include: - Adding to "caMassClass" support for reading and writing mzXML data - a standard for storing proteomics MS data. - Adding more error checking to 'runmean', 'runmin', 'runmax', 'runmad' & 'runquantile' functions - Writing 3 new functions for round-off-error free sumation: 'sum.exact', 'cumsum.exact' and 'runsum.exact'. - Added option to "runmean" function to allow use of above...
2005 Jun 17
0
Release of new version of caMassClass package and new package caT ools
...which might be useful to broader group, is much smaller than "caMassClass" and has fewer dependencies. Other changes include: - Adding to "caMassClass" support for reading and writing mzXML data - a standard for storing proteomics MS data. - Adding more error checking to 'runmean', 'runmin', 'runmax', 'runmad' & 'runquantile' functions - Writing 3 new functions for round-off-error free sumation: 'sum.exact', 'cumsum.exact' and 'runsum.exact'. - Added option to "runmean" function to allow use of above...
2011 Nov 21
1
coverage plot
...header=F) colnames(data)<-c("Scaffold","sca_position","coverage") depth<-mean(data[,"coverage']) #depth now has the mean (overall)coverage #set the bin-size window<-1001 rangefrom<-0 rangeto<-length(data[,"sca_position"]) data.1kb<-runmean(data[,"coverage"],k=window) png(file="cov_1k.png",width=400,height=1000) plot(x=data[rangefrom:rangeto,"sca_position"],y=data.1kb[rangefrom:rangeto],pch=".",cex1,xlab="bp position",ylab="depth",type="p") dev.off() I got these er...
2005 Apr 02
1
Survey of "moving window" statistical functions - still looking f or fast mad function
Hi, First, let me thank Jaroslaw for making this survey. I find it quite illuminating. Now the questions: * the #1 solution below (based on cumsum) is numerically unstable. Specifically if you do the runmean on a positive vector you can easily get negative numbers due to rounding errors. Does anyone see a modification which is free of this deficiency? * is it possible to optimize the algorithm of the filter function, solution #2 below, for the case of the rep(1/k,k) kernel? Thanks, Vadim [R] Survey...
2008 Feb 13
4
rolling sum (like in Rmetrics package)
Hello, I'm new to R and would like to know how to create a vector of "rolling sums". (I have seen the Rmetrics package and the rollMean function and I would like to do the same thing except Sum instead of Mean.) I imagine someone has done this, I just can't find it anywhere. Example: x <- somevector #where x is 'n' entries long #what I would like to do is: x1
2005 Sep 30
3
.C help
Hi, I am hoping some one can help me. I am learning to use C and would like to learn how to call c code in R. I have look at Writing R Extensions and I tried to copy the example on page 38 void convolve(double *a, int *na, double *b, int *nb, double *ab) { int i, j, nab = *na + *nb - 1; for(i = 0; i < nab; i++) ab[i] = 0.0; for(i = 0; i < *na; i++) for(j = 0; j <
2011 Apr 04
1
moving mean and moving variance functions
Hello Lets say as an example I have a dataframe with the following attributes: rownum(1:405), colnum(1:287), year(2000:2009), daily(rownum x colnum x year) and foragePotential (0:1, by 0.01). The data is actually stored in a netcdf file and I'm trying to provide a conceptual version of the data. Ok. I need to calculate a moving mean and a moving variance for each cell on the following
2012 Jan 11
0
Error in charToDate(x)
...ySMI(EURUSD) + myADX(EURUSD) + myAroon(EURUSD) + myBB(EURUSD) + myChaikinVol(EURUSD) + myCLV(EURUSD) +myEMA10(EURUSD) +myEMA20(EURUSD) +myEMA30(EURUSD) +myEMA50(EURUSD) + myEMA60(EURUSD) + CMO(Cl(EURUSD)) + EMA(Delt(Cl(EURUSD))) + myVolat(EURUSD) + myMACD(EURUSD) + RSI(Cl(EURUSD)) + mySAR(EURUSD) + runMean(Cl(EURUSD)) + runSD(Cl(EURUSD))) I then tried to do the following: Tdata.train <- as.data.frame(modelData(data.model, data.window=c('2011-08-03','2011-12-30'))) This gave me the following error: Warnmeldungen: 1: In which(index(model.data) >= as.Date(data.window[1], origin...
2006 Jan 23
2
Master's project to coerce linux nvidia drivers to run generalised linear models
Hi, I am working with a friend on a master's project. Our laboratory does a lot of statistical analysis using the R stats package and we also have a lot of under-utilised nvidia cards sitting in the back of our networked linux machines. Our idea is to coerce the linux nvidia driver to run some of our statistical analysis for us. Our first thought was to specifically code up a version of
2011 Sep 02
2
Avoiding for Loop for moving average
Hello, I need to calculate a moving average and an exponentially weighted moving average over a fairly large data set (500K rows). Doing this in a for loop works nicely, but is slow. ewma <- data$col[1] N <- dim(data)[1] for(i in 2:N){ data$ewma <- alpha * data$ewma[i-1] + (1-alpha) * data$value[i] } Since the moving average "accumulates" as we move through the data,
2012 Mar 03
4
Sliding a Window in R
Dear all, I am having a vector of around 300.000 elements and I Want to slide fast a window from the first element until the last-Windowsize what I have so far is the following for statement:  for (i in 1:(length(data[,1]) - windowSize)) {         out[i] <- mean(data[i:(i + windowSize - 1), ])         elements[i]<-length(i:(i + windowSize - 1))       } but this of course takes ages to
2004 Oct 08
1
Survey of "moving window" statistical functions - still looking f or fast mad function
...s that were suggested, and few ways I come up with. The purpose of this email is to share some of my findings and ask for more suggestions (especially about moving mad function). Sum over moving window can be done using many different ways. Here are some sorted from the fastest to the slowest: 1. runmean = function(x, k) { n = length(x) y = x[ k:n ] - x[ c(1,1:(n-k)) ] # this is a difference from the previous cell y[1] = sum(x[1:k]); # find the first sum y = cumsum(y) # apply precomputed differences return(y/k)...
2006 Jul 26
3
Moving Average
Dear R-Users, How can I compute simple moving averages from a time series in R? Note that I do not want to estimate a MA model, just compute the MA's given a lenght (as excel does). Thanks ________________________________________ Ricardo Gonçalves Silva, M. Sc. Apoio aos Processos de Modelagem Matemática Econometria & Inadimplência Serasa S.A. (11) - 6847-8889 ricardosilva@serasa.com.br
2010 Jan 21
3
Na.omit on matrix, does the matrix have to have a limited size
Hello everyone, I am using the na.omit() function on a 785 x 79 matrix. When I restrict the matrix to 10 columns for example it returns me the right result with the na rows deleted: 756 x 10 matrix. But, if I enter the whole matrix it returns me a 64 x 79 matrix, ununderstandable, I have no idea why...Does anyone know what it could be? thanks -- View this message in context:
2012 Apr 27
6
Min , Max
Hellow everyone, This code bellow will calculate average daily wind speed(measurements are taken every three hours).Any ideas how to take the Min and Max instead of average. library(Matrix) setwd("C:\\Users\\aalyaari\\Desktop\\img") listfile<-dir() long <- file("C:\\Users\\aalyaari\\Desktop\\New folder (5)\\inra.bin", "rb") A=readBin(long, integer(),
2011 Sep 24
1
help
...bjects (Sarah Goslee) > 23. Re: 'save' saved object names instead of objects (Downey, Patrick) > 24. Re: 'save' saved object names instead of objects (Duncan Murdoch) > 25. How to fit a non-normal-dist.-GARCH() time series? (user84) > 26. (Requested) caTools::runmean Patch (R. Michael Weylandt) > 27. Re: Wrapper of linearHypothesis (car) for post-hoc of > repeated measures ANOVA (John Fox) > 28. Re: Re-installing R (John C Frain) > 29. comparing factor and value data (rather offtopic) (Petr PIKAL) > 30. Re: Correlation of varia...