Displaying 20 results from an estimated 30000 matches similar to: "for/if loop in R"
2012 Mar 10
1
Generating abnormal returns in R
Hello
This is my first post on this forum and I hope someone can help me out.
I have a datafile (weeklyR) with returns of +- 100 companies.
I acquired this computing the following code:
library("tseries");
tickers = c("GSPC" , "BP" , "TOT" , "ENI.MI" , "VOW.BE" , "CS.PA" ,
"DAI.DE" , "ALV.DE" ,
2006 Jul 06
2
KPSS test
Hi,
Am I interpreting the results properly? Are my conclusions correct?
> KPSS.test(df)
---- ----
KPSS test
---- ----
Null hypotheses: Level stationarity and stationarity around a linear trend.
Alternative hypothesis: Unit root.
----
Statistic for the null hypothesis of
level stationarity: 1.089
Critical values:
0.10 0.05 0.025 0.01
0.347 0.463
2007 Dec 08
2
time series tests
Hi all,
Can anyone clear my doubts about what conclusions to take with the following what puts of some time series tests:
> adf.test(melbmax)
Augmented Dickey-Fuller Test
data: melbmax
Dickey-Fuller = -5.4075, Lag order = 15, p-value = 0.01
alternative hypothesis: stationary
Warning message:
p-value smaller than printed p-value in: adf.test(melbmax)
2003 Jun 03
1
tseries "adf.test"
I have a question regarding the adf.test command in the tseries library.
I have a vector of time series observations (2265 daily log prices for the
OEX to be exact). I also have this same data in first-differenced form. I
want to test both vectors individually for staionarity with an Augmented
Dickey-Fuller test. I noticed when I use the adf.test command from the
tseries library, the general
2011 Mar 04
1
Time series analysis for a daily series
Hi everyone
I am trying to do some time series analysis with daily temperature data
(40 years). I have created a zoo object and ts object but can't apply
stl function. It says the series is not periodic or has less than two
periods. I've searched through google and found a lot of messages about
this problem but not a solution/example to look for trend and seasonal
component of a
2011 Dec 01
3
Assign name to object for each iteration in a loop.
Hi R-users,
I'm trying to produce decompositions of a multiple time-series, grouped by a
factor (called "area"). I'm modifying the code in the STLperArea function of
package ndvits, as this function only plots produces stl plots, it does not
return the underlying data.
I want to extract the trend component of each decomposition
("x$time.series[,trend]), assign a name
2006 Jul 06
1
Access values in kpssstat-class
Hi,
How can I access the Values stored in kpssstat-class given by KPSS.test function and store it in a variable.
For example:
>x <- rnorm(1000)
>test <- KPSS.test(ts(x))
>test
---- ----
KPSS test
---- ----
Null hypotheses: Level stationarity and stationarity around a linear trend.
Alternative hypothesis: Unit root.
----
Statistic for the null
2006 Sep 20
1
Simulation help
I'm trying to simulate trend data over a five year period. I want
different trend profiles...the simplest being a linear trend. I've been
using the following code:
patBdta1 <- NULL
for(i in 1:100)
patBdta1 <- rbind(patBdta1,c(yr1= mean(rbinom(50,1,.50)),
yr2 =mean(rbinom(50,1,.51)),
yr3 =mean(rbinom(50,1,.52)),
2009 Nov 08
2
linear trend line and a quadratic trend line.
Dear list users
How is it possible to visualise both a linear trend line and a quadratic trend line on a plot
of two variables?
Here my almost working exsample.
data(Duncan)
attach(Duncan)
plot(prestige ~ income)
abline(lm(prestige ~ income), col=2, lwd=2)
Now I would like to add yet another trend line, but this time a quadratic one. So I have two
trend lines. One linear trend line
2004 Jun 16
4
non-linear binning? power-law in R
First, thanks to everyone who helped me get to grips with R in (x)emacs
(I get confused easily). Special thanks to Stephen Eglen for continued
support.
My question is about non-linear binning, or density functions over
distributions governed by a power law ...
y ~ mu*x**lambda # In one of its forms
# (can't find Pareto in the online help)
Looking at the following
2004 Feb 28
2
questions about anova
Hello all,
I have two questions about anova (one is probably VERY basic...)
1 - when one asks for a summary of a trend surface created with surf.ls, he/she
gets:
> summary(g3r)
Analysis of Variance Table
Model: surf.ls(np = 3, x = gradiente$east, y = gradiente$north, z =
gradiente$num1)
Sum Sq Df Mean Sq F value Pr(>F)
Regression 215.7182 9 23.968693976
2012 Sep 26
1
Running different Regressions using for loops
Hi,
I am trying to run many different regressions using a FOR Loop.
The input data that is read into R has the following variables
· Volume
· Price1
· Price2
· Price3
· Price4
· Price5
· Trend
· Seasonality
I want to run 5 regressions, with the Volume as an dependent variable and
Price, Trend & Seasonality as
2018 Apr 15
2
packageDate() segfaults, if used without argument
Out of curiosity, I played a bit with the new function packageDate()
from April, 4th. All works fine, except using it without any argument.
In this case, it segfaults:
#> packageDate()
Error in packageDescription(pkg, lib.loc = lib.loc, fields = date.fields) :
argument "pkg" is missing, with no default
*** caught segfault ***
address 0x77bc3c0, cause 'memory not mapped'
2005 Jun 14
1
using forecast() in dse2 with an ARMA model having a trend component
(My apologies if this is a repeated posting. I couldn't find any trace
of my previous attempt in the archive.)
I'm having trouble with forecast() in the dse2 package. It works fine
for me on a model without a trend, but gives me NaN output for the
forecast values when using a model with a trend. An example:
# Set inputs and outputs for the ARMA model fit and test periods
2010 Feb 07
2
predicting with stl() decomposition
Hi mailinglist members,
I’m actually working on a time series prediction and my current approach is
to decompose the series first into a trend, a seasonal component and a
remainder. Therefore I’m using the stl() function. But I’m wondering how to
get the single components in order to predict the particular fitted series’.
This code snippet illustrates my problem:
series <-
2005 Mar 08
2
The null hypothesis in kpss test (kpss.test())
is that 'x' is level or trend stationary. I did this
> s<-rnorm(1000)
> kpss.test(s)
KPSS Test for Level Stationarity
data: s
KPSS Level = 0.0429, Truncation lag parameter = 7,
p-value = 0.1
Warning message:
p-value greater than printed p-value in:
kpss.test(s)
My question is whether p=0.1 is a good number to
reject
N0? On the other hand, I have a
2009 Dec 18
1
linear contrasts for trends in an anova
Hi everybody,
I'm trying to construct contrasts for an ANOVA to determine if there is a significant trend in the means of my groups.
In the following example, based on the type of 2x3 ANOVA I'm trying to perform, does the linear polynomial contrast generated by contr.poly allow me to test for a linear trend across groups?
doi=data.frame(
Group=c(
rep(1, 5), rep(2, 5), rep(3, 5),
2011 May 18
1
Multiple plots on one device using stl
G'day,
I am looking at monthly reports, and have three series of monthly data from 2007 to 2009. I would like to show the season decomposition of these two series side by side on the one device, however using plot doesn't seem to respect any use of layout(matrix(1:3, ncol=3)) or par(mfcol=c(1,3)).
I'm guessing that this means that the plot(stl) perhaps uses them, but I can't find
2012 Nov 02
6
FreeBSD 9.1 stability/robustness?
I need to build up a few servers and routers, and am wondering how
FreeBSD 9.1 is shaping up. Will it be likely to be more stable and
robust than 9.0-RELEASE? Are there issues that will have to wait
until 9.2-RELEASE to be fixed? Opinions welcome.
--Brett Glass
2004 Nov 24
1
how to remove time series trend in R?
I got a set of data which has seasonal trend in form of sinx, cosx, I
don't have any idea on how to deal with it.
Can you give me a starting point? Thanks,
Terry