search for: statmailinglists

Displaying 14 results from an estimated 14 matches for "statmailinglists".

2010 Dec 31
4
Repeated Indexing / Sequence Operation
Hi Everyone, quick question before the end of the year. I have soem indices to select data from a bigger sample. I want to select n days before each index and n days after the index. Any clever way to do it. A for loop would do but I wanted to know if there is a moreR-friendly way to approach this Example # InitialIndices i2 = (90, 190, 290) # Indices I want to end up with i3 = c(85, 86, 87,
2010 Nov 17
3
Parameterising apply To Compute Rolling Average of Columns in a matrix
I sent a post to find a clever way to compute a Rolling Average of columns in a matrix and I was given the solution below which I am very pleased with. RollingAverage <- function(x, RollingObs) { cx <- cumsum(x); N <- length(x); Temp <- (cx[RollingObs:N] - c(0, cx[1:(N-RollingObs)]))/RollingObs Output <- array(NA, N) Output[RollingObs:N] <- Temp; Output } The only
2011 May 19
1
Converting Variable Name into String
Hello, I would like to create lagged and delta variables from a set of variables and then add them to a dataframe Suppose that GDPPcSa is a variable. I would like to be able to do this QuarterlyData$D1GdpPcSa = diff(GDPPcSa , 1) in an automated fashion so that I loop over Quartely data to compute the first difference of its variables and add them to the dataframe. .It would be great to get a
2011 Jul 08
2
Vertical Labels in plot graph - normally working fine but not on this graph
Hello, I wonder if someone can elaborate on why in the first graph I am able to set labels vertical to the x-axis but not in the second. I tried to select the window but it didnt really help. Many Thanks Paolo ExtAvgCWV = rnorm(200) ExtAvgDemand = rnorm(200) ExtGasDays = seq(from = as.Date("2010-8-4", "%Y-%m-%d"), along.with = ExtAvgCWV, by = "days")
2010 Dec 20
2
Sine Regression in R
Hi everyone, I am trying to fit a sine function on one year of wind data. I have two questions below. Looking around on the net I managed to get the following: Sine Equation: y = a + b * sin( c + d*x ) b is the amplitude, c is the phase shift, d is something deal with periodicty of data*.* This can be linearised by sin( c+dx ) = cos(c) * sin(dx) + sin(c) * cos(dx). If one calls dx = x1 y
2011 Jul 06
1
Group Data indexed by n Variables
Hello, the more general thing I'd like to learn here is how to compute Function of Data on the basis of grouping determiend by n variables. In terms of the reason why I am interested in this, I need to compute the average of my data based on the value of the month and day across years. I have come up withy the code below which, as far as I can see, does what I need but getting either a more
2011 Jun 15
3
Column of numbers added to dataframe when saving with read.csv
I have a dataframe object having the following structure FinalOutput[1:3,] GasDays 2011-03-31 2010-09-30 2010-10-31 2010-11-30 2010-12-31 2011-01-31 2011-02-28 1 2006-10-01 217303553 221205033 222824639 217016511 216093460 216477468 216834021 2 2006-10-02 231158527 234565250 236004109 231467851 230100639 230079907 230734064 3 2006-10-03 282062314 285427832 286372163
2010 Dec 19
3
monthly median in a daily dataset
Hello, I have a multi-year dataset (see below) with date, a data value and a flag for the data value. I want to find the monthly median for each month in this dataset and then plot it. If anyone has suggestions they would be greatly apperciated. It should be noted that there are some dates with no values and they should be removed. Thanks Emily > print ( str(data$flow$daily) )
2011 Feb 01
1
Estimation and Forecast of Seasonal Component
Hi list, I would like to estimate and forecast the seasonal component of a series. My model which uses daily data would be something y t = alpha + beta x SeasComp t + gamma x OtherRegressors t. One approach to this would be use quarterly dummies, another to use a sine function. The first would cause a step change when we move from a season to another; the latter impose too much regularity in
2010 Dec 31
1
Error using sos
I am trying to use sos but I get the message below My PC's spec is: MS XP Version 2002 SP 3 Intel Celeron E3300 @ 2.50Ghz Is the error below related to a firewall or something? Thanks and Happy New Year Paolo Error in readLines(link) : cannot open the connection In addition: Warning message: In readLines(link) : unable to connect to 'search.r-project.org' on port 80. found 0
2011 Jan 03
1
ARIMA simulation including a constant
Hi, I have been looking at arima.sim to simulate the output from an ARMA model fed with a normal and uncorrelated input series but I cannot find a way to pass an intercept / constant into the model. In other words, the model input in the function allows only for the AR and MA components but I need to pass a constant. Can anyone help? Thanks Paolo [[alternative HTML version deleted]]
2010 Nov 14
1
Problems loading xlsx
Hi all, I am trying to run the package xlsx to read Excel 2007 files and I am getting the error below. > library(xlsx) Loading required package: xlsxjars Loading required package: rJava Error : .onLoad failed in loadNamespace() for 'xlsxjars', details: call: .jinit() error: cannot obtain Class.getSimpleName method ID Error: package 'xlsxjars' could not be loaded By
2010 Dec 20
2
Turning a Variable into String
I would like to know how to turn a variable into a string. I have tried as.symbol and as.name but it doesnt work for what I'd like to do Essentially, I'd like to feed the function below with two variables. This works fine in the bit working out number of elements in each variable. In the print(sprintf("OK with %s and %s\n", var1, var2)) line I would like var1 and var2 to be
2010 Nov 16
2
Computing Rolling Average
Hi, Can anyone suggest a clever way to compute a rolling weekly average of the columns in a matrix? The column bit is straightforward – use apply given a function which does what you want on a column. With regard to a particular column, the obvious way is to run a for loop indexing the last 7 days and computing the average . I simply would like to know if there is a better / quicker way.