Displaying 20 results from an estimated 600 matches similar to: "Calculate a function repeatedly over sections of a ts object"
2012 Mar 08
3
Calculating length of consecutive sequences within a vector
Hi all,
I have a nx1 logical array of zeros and ones and I want to calculate the individual lengths of all 1-consecutive sequences contained in it. Is there an easy quick way to do this in R? So, if I have a vector such as
111001101000011111110
I would like to get (1) 3, (2) 2, (3) 1, (4) 7
Any help would be appreciated! thanks!
Jorge
[[alternative HTML version deleted]]
2012 Jan 22
1
Problem with sapa package and spectral density function (SDF)
Hi everybody,
I'm a beginner R user and I'm trying to use the package "sapa" to
estimate the spectral density function of several time series using
the SDF function. For each time series, I want to calculate the
density function at two temporal resolutions (daily and monthly). The
monthly values calculated as a mean of the daily values. I first
create a ts object for both series
2024 Jul 10
1
Implementation for selecting lag of a lag window spectral estimator using generalized cross validation (using deviance)
Dear All,
I am looking for:
A software to select the lag length for a lag window spectral estimator.
Also, I have a small query in the reprex given below.
Background for the above, from the book by Percival and Walden:
1. We are given X_1,...,X_n which is one realization of a stochastic process.
2. We may compute the periodogram using FFT, for example by the
function spectrum in R.
3. The
2009 Oct 15
1
.Call() function
Dear all,
What is the usage of the ".Call()"?
What is the meaning of the follows:
S=.Call("RS_fractal_spectral_density_function_direct",x,as.vector(taper.),as.logical(center),as.logical(recenter),TRUE,as.integer(npad),COPY=rep(FALSE,6),CLASSES=c(rep("matrix",2),rep("logical",3),"integer"),PACKAGE="ifultools")
And is a function
2001 Sep 25
1
parzen-window, tukey window
Dear R-user and -programmer,
has one R-package the ability to compute smoothed periodograms of time
series using the Tukey-window and/or the Parzen-window? In the ts- and
tseries-packages I have found only Daniell-smoothers.
With many thanks in advance for any hint
Albrecht Kauffmann
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read
2012 Mar 07
4
Difference in Kaplan-Meier estimates plus CI
I thought this would be trivial, but I can't find a package or function
that does this.
I'm hoping someone can guide me to one.
Imagine a simple case with two survival curves (e.g. treatment & control).
I just want to calculate the difference in KM estimates at a specific time
point (e.g. 1 year) plus the estimate's 95% CI. The former is
straightforward, but the estimates not
2009 Nov 23
1
Calibration score for survival probability
Good afternoon!
I need to evaluate the goodness-of-fit (aka calibration) for survival probability estimates from a Cox model.
I tried to use 'calibrate' in the Design package but I'm not sure if it should/would produce what I need (ie a chi-sq type statistic with a table of expected vs observed probabilities). Any other functions I should be aware of?
Also, has anybody come across
1999 Jul 19
9
time series in R
Time Series functions in R
==========================
I think a good basic S-like functionality for library(ts) in base R
would include
ts class, tsp, is.ts, as.ts
plot methods
start end window frequency cycle deltat
lag diff aggregate
filter
spectrum, spec.pgram, spec.taper, cumulative periodogram, spec.ar?
ar -- at least univariate by Yule-Walker
arima -- sim, filter, mle, diag, forecast
2010 Apr 03
0
smoothing with sapa package and decibel function
Hello,
I'm new to R.
In Sapa package there's an example for function SDF like
data <- as.numeric(sunspots)
methods <- c("direct","wosa","multitaper","lag window")
S <- lapply(methods, function(x, data) SDF(data, method=x), data)
x <- attr(S[[1]], "frequency")[-1]
y <- lapply(S,function(x) decibel(as.vector(x)[-1]))
which
2004 Sep 20
1
unable to load shared library "/home/hpc1367/runs/taper/taper.so"
I am trying to load a .so file and get the following error message:
> dyn.load("taper.so",local=F)
Error in dyn.load(x, as.logical(local), as.logical(now)) :
unable to load shared library
"/home/hpc1367/runs/taper/taper.so":
ld.so.1: /usr/local/lib/R/bin/R.bin: fatal: relocation error: file
/home/hpc1367/runs/taper/taper.so: symbol f90_init: referenced symbol
not
2012 Jan 18
4
R-Help
I am trying to create a frequency distribution and I am a bit confused.
Here are the commands I have entered:
> data <- read.csv(file="40609_sortedfinal.csv",head=TRUE,sep=",")
> NumberOfActionsByStatus = data$STATUS
> NumberOfActionsByUser = data$ETS_LOGIN
> NumberOfBidOffer = data$BID_OFFER
> NumberOfActionsByUser.freq = table(NumberOfActionsByUser)
>
2006 May 17
1
Documentation for taper in spec.taper (PR#8871)
Full_Name: Michael Stein
Version: Version 2.1.1
OS: linux
Submission from: (NULL) (128.135.149.112)
The documentation for spec.taper says
p: The total proportion to be tapered, either a scalar or a
vector of the length of the number of series.
Details:
The cosine-bell taper is applied to the first and last 'p[i]/2'
observations of time series 'x[,
2009 Oct 22
1
Help regarding removing Inf from dataframe, creating new dataframe with selected variables, count function
Following is my query:
1. Removing Inf from one column of dataframe.
2. out of 10 available dates, count how many times a security is present. (repeat for each security)
3. Out of dates, the security is present, I want to read latest status of market cap.
4. Change in market cap represent by 0/1 so even if market cap status changed once, take value 1.
5. create output file containing some already
2003 Mar 12
2
Backup - suggestions needed....
Linux RH 7.3, Samba 2.2.7a
NT 4.0 SP6 - Backup Exec 8.5
The linux box is running the Backup Exec client for Unix
('http://seer.support.veritas.com/docs/192093.htm')
Occasionally, when doing a backup the entire linux system freezes. I have
to do a hard reboot without a shutdown, etc.
There is 40 plus gigs on the backup, so I dont think a tar and copy would be
bery efficient.
I am
2008 Jun 09
2
using spec.pgram
Hi everyone,
first of all, I would like to say that I am a newbie in R, so I apologize in
advance if my questions seem to be too easy for you.
Well, I'm looking for periodicity in histograms. I have histograms of
certain phenomenons and I'm asking whether a periodicity exists in these
data. So, I make a periodogram with the function spec.pgram. For instance,
if I have a histogram h, I
2007 Nov 25
1
spec.pgram() - circularity of kernel
Hi,
I am far from experienced in both R and time series hence the question.
The code for spec.pgram() seems to involve a circularity of the kernel (see
below) yielding new power estimates to all frequencies computed by FFT.
"
if (!is.null(kernel)) {
for (i in 1:ncol(x)) for (j in 1:ncol(x)) pgram[, i,
j] <- kernapply(pgram[, i, j], kernel, circular = TRUE)
2020 Oct 19
1
spec.pgram returns different spectra when fast=TRUE and the number of samples is odd
Dear all,
This is potentially a bug in spec.pgram, when the number of samples is odd,spec.pgramreturns a different result withfast = TRUE, the example below contains the two varieties with a reference spectrum calculated manually. the number of returned spectra is also larger (50 compared to 49) whenfast = TRUE
x <- rnorm(
99
)
plot(spec.pgram(x, taper =
0
, detrend =
FALSE
, plot =
2002 Jul 26
0
Parzen Windows
I suspect Prof. Ripley's response suffices. However, there *is* a Parzen
kernel for kernel smoothing:
Parzen K(z) = { 4/3 - 8z^2 + 8|z|^3 if |z| <= 1/2
8(1 -|z|)^3/3 if 1/2 < |z| <= 1
0 otherwise
If I'm not mistaken, this appeared in Parzen's original 1962 paper on kernel
density estimation. I also seem to recall
2007 Dec 12
2
discrepancy between periodogram implementations ? per and spec.pgram
hello,
I have been using the per function in package longmemo to obtain a
simple raw periodogram.
I am considering to switch to the function spec.pgram since I want to be
able to do tapering.
To compare both I used spec.pgram with the options as suggested in the
documentation of per {longmemo} to make them correspond.
Now I have found on a variety of examples that there is a shift between
2002 Apr 10
1
Layout of Fourier frequencies
I'm doing convolutions in the frequency domain and need to know the
layout of the Fourier modes returned by fft. (This is leading up to a
more involved question about moment generating functions, but I need to
know if I've got this part correct first.)
I think in 1D the pattern is:
0 1 2 3 -2 1 (even)
0 1 2 3 -3 2 1 (odd)
In 2D is it simply (for a square matrix):
0 1 2 -1 (horizontal)