Displaying 20 results from an estimated 11000 matches similar to: "Running Median and Mean"
2007 Feb 20
1
baseline fitters
I am pretty pleased with baselines I fit to chromatograms using the
runquantile() function in caTools(v1.6) when its probs parameter is
set to 0.2 and its k parameter to ~1/20th of n (e.g., k ~ 225 for n ~
4500, where n is time series length). This ignores occasional low-
side outliers, and, after baseline subtraction, I can re-adjust any
negative values to zero.
But runquantile's
2012 Mar 03
1
Sliding Window in R (solved)
Dear all,
you can find below my solution for sliding a window. Please find below the code for the two alternatives and the benchmarks.
install.packages('caTools')
require(caTools)
do_sliding_for_a_window_duty_cycle <- function(DataToAnalyse, windowSize) {
data<-DataToAnalyse
out <- numeric()
elements<- numeric()
if (length(data[,1]) >= windowSize){
for
2002 Aug 20
1
Running median
I have a Date x Stock (223 x 520) matrix of "trading volume". I can calculate
a 5-day (past) average in about 1 second using:
R> apply(vol, 1, filter, filter=c(0, rep(1/5,5)), sides=1)
I would like to do the same with a 5-day median, e.g.:
R> mymed <- function(x, n=5) {
R> r <- rep(NA, length(x))
R> for (i in (n+1):length(x)) r[i] <- median(x[i-(1:n)])
R>
2002 Feb 06
4
Weighted median
Is there a weighted median function out there similar to weighted.mean()
but for medians? If not, I'll try implement or port it myself.
The need for a weighted median came from the following optimization
problem:
x* = arg_x min (a|x| + sum_{k=1}^n |x - b_k|)
where
a : is a *positive* real scalar
x : is a real scalar
n : is an integer
b_k: are negative and positive scalars
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
2001 Dec 03
1
New package: g.data
A new package "g.data" is available on CRAN, to create and maintain databases
that work more like the S-Plus model.
Here's the official Description for g.data (v1.2):
Create and maintain delayed-data packages (DDP's). Data stored in
a DDP are available on demand, but do not take up memory until requested.
You attach a DDP with g.data.attach(), then read from it and assign
2001 Dec 03
1
New package: g.data
A new package "g.data" is available on CRAN, to create and maintain databases
that work more like the S-Plus model.
Here's the official Description for g.data (v1.2):
Create and maintain delayed-data packages (DDP's). Data stored in
a DDP are available on demand, but do not take up memory until requested.
You attach a DDP with g.data.attach(), then read from it and assign
2011 Nov 21
1
coverage plot
Hi,
I'm very beginner for R but I think it is a time to start as it is very useful.
I have a coverage read file (illusmp454merCbed) for whole genome ~ 450 Mbp. This is head of this file.
Scaffold sca_position coverage
Scaffold1 1 0
Scaffold1 2 0
Scaffold1 3 0
Scaffold1 4 0
Scaffold1 5 0
Scaffold1 6 0
Scaffold1 7 1
Scaffold1 8 3
Scaffold1 9 3
I would like to plot everage coverage for every 1
2005 Feb 07
4
network drives
Another nicety may be handling network drives. I''ve been using a ruby
script which manipulate using the "net use" command to map network
drives, disconnect network drives, query to see what drives are
connected, etc..., but it''d be sweet if this type of functionality was
included in win32 package.
Maybe usage like:
nd = Win32::NetworkDrive.new(
2018 Jun 08
2
Subsetting the "ROW"s of an object
I suspect this will have suboptimal performance since the TRUEs will
get recycled. (Maybe there is, or could be, ALTREP, support for
recycling)
Hadley
On Fri, Jun 8, 2018 at 10:16 AM, Berry, Charles <ccberry at ucsd.edu> wrote:
>
>
>> On Jun 8, 2018, at 8:45 AM, Hadley Wickham <h.wickham at gmail.com> wrote:
>>
>> Hi all,
>>
>> Is there a better to
2001 Sep 27
5
Reading and writing to S-like databases
Hi,
I asked this question 2 years ago, and would like to know if the answer has
changed.
In S-Plus, I build databases of many large objects. In any given analysis,
I only need a few of those objects, but attach'ing the whole database is fine
since objects are only read as needed. How can I do the same thing in R,
without reading the entire database?
One possibility is to treat
2013 Jul 30
1
Puppet3 key exchange on RHEL6
I''m attempting to run Puppet 3.2.3 on RHEL6 and am running into key
problems.
The keys seem to be exchanged, or at least the puppet master receives the
key from the client:
lib_puppet2.library.nd.edu|root no_ora /var/lib/puppet 1029$ puppet cert
list --all
+ "puptest1.library.nd.edu" (SHA256)
2012 Apr 16
1
Crear nuevos métodos para funciones genéricas existentes
Perdón por anticipado ante una pregunta sólo achacable a mi ignorancia
en programación.
Estoy creando un nuevo paquete con una estructura "decente", en vez de
las chapuzas que hacía hasta ahora. Defino una función que ajusta unos
datos a una distribución que podemos llamar ND. La sintaxis de esta
función sería, de forma resumida:
ND.fit<-function(x, start, ...){
...
2018 Jun 08
3
Subsetting the "ROW"s of an object
> On Jun 8, 2018, at 10:37 AM, Herv? Pag?s <hpages at fredhutch.org> wrote:
>
> Also the TRUEs cause problems if some dimensions are 0:
>
> > matrix(raw(0), nrow=5, ncol=0)[1:3 , TRUE]
> Error in matrix(raw(0), nrow = 5, ncol = 0)[1:3, TRUE] :
> (subscript) logical subscript too long
OK. But this is easy enough to handle.
>
> H.
>
> On
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
2018 Feb 16
1
hurdle model - count and response predictions
Hello,
I'm using pscl to run a hurdle model. Everything works great until I get to
the point of making predictions. All of my "count" predictions are lower
than my actual data, and lower than the "response" predictions, similar to
the issue described here (
https://stat.ethz.ch/pipermail/r-help/2012-August/320426.html) and here (
2001 Sep 25
2
read.table() suggestions
Hi,
I understand work is being done to improve read.table(), especially by
Prof. Brian D. Ripley. I offer below a version that I wrote, in the hope some
aspects of it may prove useful or at least inspire discussion.
Be aware that my version differs in a couple fundamental ways that reflect
my aversion to dataframes and factors. So it returns a list of vectors which
are all character,
2014 Jun 16
1
model.frame and parent environment
Someone has reported a problem with predict.coxph that I can't seem to solve. The
underlying issue is with model.frame.coxph; the same issue is also found in lm so I'll use
that for the example.
--------------------------
> test <- data.frame(y = 1:10 + runif(10), x=1:10)
> myfun <- function(formula, nd) {
fit <- lm(formula, data=nd, model=FALSE)
2017 Nov 10
0
[RFC] Enable Partial Inliner by default
Hi Evgeny,
I just realized that if these are compile-time errors I can help
investigate on my end. Do you have something I can use to reproduce?
Cheers,
Graham Yiu
LLVM Compiler Development
IBM Toronto Software Lab
Office: (905) 413-4077 C2-707/8200/Markham
Email: gyiu at ca.ibm.com
From: Graham Yiu/Toronto/IBM
To: Evgeny Astigeevich <Evgeny.Astigeevich at arm.com>
Cc:
2018 Jun 08
6
Subsetting the "ROW"s of an object
Hi all,
Is there a better to way to subset the ROWs (in the sense of NROW) of
an vector, matrix, data frame or array than this?
subset_ROW <- function(x, i) {
nd <- length(dim(x))
if (nd <= 1L) {
x[i]
} else {
dims <- rep(list(quote(expr = )), nd - 1L)
do.call(`[`, c(list(quote(x), quote(i)), dims, list(drop = FALSE)))
}
}
subset_ROW(1:10, 4:6)
#> [1] 4 5 6