similar to: how to extract data by specific months from a monthly ts object

Displaying 20 results from an estimated 10000 matches similar to: "how to extract data by specific months from a monthly ts object"

2010 Jan 31
0
Package ismev, gpd.fit, and interpretation for statistics of extreme values
Dear All, I have a question about package "ismev", its function "gpd.fit", and interpretation of the results. I used the package ismev to do an extreme value analysis on a fire dataset. Two variables are used in the analysis. The focal variable is acreage burned per fire, ranging from 1 to 5000 acres per fire. In total, there are 69,980 observations. The date covers
2010 Sep 05
3
simple ts() object question
Dear Community, say, I have an annual ts() object sampled from 1960 to 1969 like: ta<-ts(1:10, start=1960, frequency=1) How can I extract the value from the year 1965? I mean, not by: ta[6] but by something like: ta[1965] where I'm directly referring to the year of the observation? Thank you in advance! -- View this message in context:
2012 Jul 23
1
mgcv: Extract random effects from gam model
Hi everyone, I can't figure out how to extract by-factor random effect adjustments from a gam model (mgcv package). Example (from ?gam.vcomp): library(mgcv) set.seed(3) dat <- gamSim(1,n=400,dist="normal",scale=2) a <- factor(sample(1:10,400,replace=TRUE)) b <- factor(sample(1:7,400,replace=TRUE)) Xa <- model.matrix(~a-1) ## random main effects Xb <-
2012 Dec 17
3
mean of each month in data
Dear R users, [in case the format of email is changed or you dont finf it easy to understand, i have attached a text file of my question] i have the data in the following format and i want to convert it in the format given at the end. Ta ans Sa are the names of certain cities. there are 69 cities in my data. column 1 is representing station name (i am writing the data of only two cities for
2008 Jan 06
1
aggregate.ts help
Hi, I have a ts object with a frequency of 4, i.e., quarterly data, and I would like to calculate the mean for each quarter. So for example: > ts.data=ts(1:20,start=c(1984,2),frequency=4) > ts.data Qtr1 Qtr2 Qtr3 Qtr4 1984 1 2 3 1985 4 5 6 7 1986 8 9 10 11 1987 12 13 14 15 1988 16 17 18 19 1989 20 If I do this manually, the mean
2012 Feb 09
1
Constraint on one of parameters.
Dear all, I have a function to optimize for a set of parameters and want to set a constraint on only one parameter. Here is my function. What I want to do is estimate the parameters of a bivariate normal distribution where the correlation has to be between -1 and 1. Would you please advise how to revise it? ex=function(s,prob,theta1,theta,xa,xb,xc,xd,t,delta) { expo1=
2007 Oct 13
2
the use of the .C function
Dear All, could someone please shed some light on the use of the .C or .Fortran function: I am trying load and running on R the following function // psi.cpp -- psi function for real arguments. // Algorithms and coefficient values from "Computation of Special // Functions", Zhang and Jin, John Wiley and Sons, 1996. // // (C) 2003, C. Bond. All rights reserved. // //
2006 Aug 02
1
RE
Hi any, Can some please detail me the createX command in bayesm package? To make things easy for you to help me, let me put forward my problem Suppose I have 3 covariates (say X matrix) and my Y has 3 categories say (1,2,3). Now from the CreateX I understand that the data matrix say 'Xa' must be of dimension n* (naxp), where 'na' is the number of variables and 'p' is
2011 Aug 15
2
plotting segments only and in color
Hello, I've a question concerning the display of interval data. A sample dataset where X is an interval between Xa and Xb which should be displayed: Y=c(15,14,23,18,19,9,19,13) Xa=c(17,22,21,18,19,25,8,19) Xb=c(22,22,29,34,19,26,17,22) X = (Xa+Xb)/2 It's easily possible to plot the mean of the interval like: plot(X,Y) afterwards I can create lines for the interval with:
2011 Mar 06
4
sorting & subsetting a data.frame
Dear all This may be obvious, but I cannot get it working. I'm trying to subset & sort a data frame in one go. x <- iris x$Species1 <- as.character(x$Species) ##subsetting alone works fine with(x, x[Sepal.Length==6.7,]) ##sorting alone works fine with(x, x[order(Sepal.Length, rev(sort(Species1))),]) ##gets subsetted, but not sorted as expected with(x, x[(Sepal.Length==6.7) &
2004 Apr 25
1
ts's in lm()
Is this a bug? seasonal.dummies <- function(x, contr=NULL) { # takes a time series and returns a matrix of seasonal dummies for # x. This is almost cycle(x), we only have to make it into a factor # and add suitable level names. # return a matrix which includes a constant! # level names here assumes frequency is 12! cyc <- factor( cycle(x), labels=c("ene","feb",
2017 May 30
2
Pseudo-instruction that overwrites its input register
On Tue, 30 May 2017, Nemanja Ivanovic wrote: > This is typically accomplished with something like PPC's `RegConstraint` and > `NoEncode`. You can see examples of it that are very similar to what you're after in > PPC's load/store with update forms (i.e. load a value and update the base register > with the effective address - these are used for pre-increment loads/stores).
2013 Apr 16
1
avoid losing data.frame attributes on cbind()
Dear all, How should I add several variables to a data frame without losing the attributes of the df? Consider the following: > require(Hmisc) > Xa <- iris > label(Xa, self=T) <- "Some df label" > str(Xa) 'data.frame': 150 obs. of 5 variables: $ Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ... $ Sepal.Width : num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9
2011 Nov 22
5
x, y for point of intersection
Hi everyone, ? I am trying to get a point of intersection between a polyline and a straight line ?.. and get the x and y coordinates of this point. For exemplification consider this: ? ? set.seed(123) ? k1 <-rnorm(100, mean=1.77, sd=3.33) ?k1 <- sort(k1) q1 <- rnorm(100, mean=2.37, sd=0.74) q1 <- sort(q1, decreasing = TRUE) plot(k1, q1, xlim <- c((min(k1)-5),
2009 Nov 25
1
group generics
I have classes A and B, where B contains A. In the implementation of the group generic for B I would like to use the corresponding group generic for A. Is there a way to do that? I would also appreciate any comments if what I'm trying to do seems like the wrong approach. Here's a stripped down example: setClass("A",
2010 May 12
2
How to extract sum of particular months in a monthly data series
Dear Users, I have a monthly data for a number of years(1960-2007) for a number of stations and i wish to extract sesonal time-series for the months of March-May and October-November for very station. I have read this data with read.table in R with stations as columns and time (months) as rows. My attempt to aggregate with the zoo package using the function as.yearqtr failed since this sums
2011 Oct 10
4
correlation matrix
Hello Gurus I have two correlation matrices 'xa' and 'xb' set.seed(100) d=cbind(x=rnorm(20)+1, x1=rnorm(20)+1, x2=rnorm(20)+1) d1=cbind(x=rnorm(20)+2, x1=rnorm(20)+2, x2=rnorm(20)+2) xa=cor(d,use='complete') xb=cor(d1,use='complete') I want to combine these two to get a third matrix which should have half values from 'xa' and half
2012 Jul 10
3
fill 0-row data.frame with 1 line of NAs
Dear all Is there a simpler method to achieve the following: When I obtain an empty data.frame after subsetting, I need for it to contain one line of NAs. Here's a dummy example: > (.xb <- iris[ iris$Species=='zz', ]) [1] Sepal.Length Sepal.Width Petal.Length Petal.Width Species <0 rows> (or 0-length row.names) > dim(.xb) [1] 0 5 > (.xa <-
2009 Mar 20
1
Mean-replacing NAs in a 3d array
Hi all I have a 3d array containing missing values. > Xa , , 1 [,1] [,2] [1,] 1 3 [2,] NA 4 , , 2 [,1] [,2] [1,] 5 7 [2,] NA NA , , 3 [,1] [,2] [1,] 9 11 [2,] 10 12 I want to replace the missing values with the mean, but the mean of each 'page' in the array (wrong terminology I'm sure). So - for the array above - [2,1,2] and
2004 Mar 10
3
converting lists got by tapply to dataframes
I have two lists: xa <- list( X=c(1,2,3), Y=c(4,5,6), Z=c(7,8,9) ) xb <- with( barley, tapply( X=seq(1:nrow(barley)), INDEX=site , FUN=function(z)yield[z])) I can convert xa to a dataframe easily with: as.data.frame(xa) But if i try the same with xb I get: as.data.frame(xb) Error in as.data.frame.default(xb) : can't coerce array into a data.frame What