Lane, Jim | 20 Aug 14:03

How to concatenate values from a time series and a forecast

Hi, All

I have a time series object:

o1ts
     Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2005                  56  58  67  68  69  71  78  78
2006  84  83  86  97 103 123 120 134 131 127 135 137
2007 142 138 141 151 155 173 181 188 195 191 262 273
2008 283 295 311 327 334 340 361     

And a forecast derived from it:

> o1fa
         Point Forecast Lo 95 Hi 95
Aug 2009            374   349   398
Sep 2009            386   350   423
Oct 2009            399   352   446
Nov 2009            412   354   469
Dec 2009            424   357   492
Jan 2009            437   359   515
Feb 2009            450   361   538
Mar 2009            463   364   562
Apr 2009            475   366   585
May 2009            488   367   609
Jun 2009            501   369   633
Jul 2010            513   370   657
Aug 2010            526   371   681
Sep 2010            539   372   705
Oct 2010            552   373   730
(Continue reading)

N'DOYE Souleymane | 20 Aug 13:24

Switch from ndoye_p <at> hotmail.com to ndoye.souleymane <at> gmail.com

Dear all,

My email address has changed today to ndoye.souleymane <at> gmail.com.

Best regards,

Souleymane

	[[alternative HTML version deleted]]

______________________________________________
R-help <at> r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Wesley Roberts | 20 Aug 12:33

pdf filenames in while loop

Dear R users,

I am a remote sensing researcher currently studying the use of LiDAR data for quantifying tree height, in
particular I would like to determine the sample size needed to capture and quantify canopy height
variability. To do this I have employed the use of automap(), which automatically calculates variograms
including reporting the range of the variogram. The program is easy to use and I have had much success with
it. However, I have run into a  slight problem. My analysis consists of 60 independent plots located in our
study area and I wish to run the variogram analyses for each plot and then write the resulting plot to a pdf
file. Given that I have 60 plots I would like to vary the name of each file based on the plot being processed,
see my code below. I have tried a number of different ap
 proaches using the paste() command but cant seem to get it to work.

Currently, as.character does not seem to solve the problem

pdf(file="as.character(paste(f.mat[a])).pdf")

alternatively I could write out to JPEG but I would rather not take that approach or I could write all pdf
plots to one file but I am not sure how to do this.

Could someone suggest a solution?

I am using R version 2.7.1 (2008-06-23) on Ubuntu 7.10.

Many thanks,
Wesley

library(gstat)
library(automap)

## List of files to be used in the while loop
(Continue reading)

Time Series w/irregular frequency, how to construct a time series object?

Hello,

I am having trouble constructing a time series object for my data. This is
because the frequency is irregular: one year, there may be only 100
individuals, another 200. There are 100 measurements for every individual. I
have the observations in a data frame with the year that they were taken from
as a factor.

I would like to plot the top 10 mean measurements for each year and connect them
with a line, to measurements in the same category. I would also like to try
using linear filtering and exponential smoothing on the measurements to look
for patterns, in particular synchronized drastic changes in measurement values.

Are all the time-series analysis functions inappropriate because of the
irregular frequency in my data? I looked at the reference manual, and it seems
that even building the tsp attribute manually would require providing a
frequency argument. It's quite possible that I have some very wrong ideas about
time series analysis, as I am just beginning to study the subject.

Thanks for any help,

--Marco

______________________________________________
R-help <at> r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

(Continue reading)

S M Niaz Arifin | 20 Aug 09:13

Re gression with Intersection Constraint


Hi,
Previously I posted a thread asking help on how to best-fit (in the least
squares sense) a straight line through a set of data points. Thanks a lot to
all replying to it. I managed it in Matlab using a function 'fit_3D_data'
(link: 
http://webscripts.softpedia.com/script/Scientific-Engineering-Ruby/Statistics-and-Probability/Orthogonal-Linear-Regression-in-3D-space-35532.html).

But to add a 'simple' constraint to the problem, I am stuck. Here it is:

I have two sets of data points, representing two separate straight lines
(call A and R) that intersect at a point. I need to find the least-square
fit to these lines, subject to their intersection constraint. So, the
important part is that the two best-fit lines must intersect at the 'best'
intersection point as determined by the data points.
Is there any way to do this in R (I am also trying in Matlab, but yet to get
any solution)?

Here is what it looks like in Matlab:

load pointsA.txt
xdataA = pointsA(:,1);
ydataA = pointsA(:,2);
zdataA = pointsA(:,3);

load pointsR.txt
xdataR = pointsR(:,1);
ydataR = pointsR(:,2);
zdataR = pointsR(:,3);

(Continue reading)

tangyong05 | 20 Aug 09:00

quantile regression - estimation of CAViaR


 Mr./Ms.

Thank your help

I need the code of quantile regression - estimation of CAViaR, would do you like to 

 help me! 

 
 regards,

 
tangyong  

  school of managemnet ,fuzhou university, China

	[[alternative HTML version deleted]]

______________________________________________
R-help <at> r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Jan de Leeuw | 20 Aug 08:51

FYI: APL in R

http://idisk.mac.com/jdeleeuw-Public/utilities/apl/apl.R

Dedicated to the IBM 2741.

Implemented for general multidimensional arrays:

drop, take, reshape, shape, rank, select, generalized inner product,  
generalized
outer product, representation, base value, join, expand, reduce, scan,
member of, ravel, compress, tranpose, rotate

Basically, the APL-I part is complete, and after some testing
and clean-up this will be 1.0. In the code there is a small section
explaining the relation between aplTP(), the APL transpose
function, and the (less general but more natural) aperm() from R.

I may decide to add some extensions from APL-X, APL-2, J,
Sharpe APL, APL 2000, Dyalog APL, later on. In any case, the
current code adds a lot of array operations (and even matrix and vector
operations) to R.

Although this is all prefix and no infix, we could easily
recreate some of the infamous APL one-liners that nobody
can possibly understand or reproduce.

===============================================================
      Jan de Leeuw, 11667 Steinhoff Rd, Frazier Park, CA 93225
      home 661-245-1725 mobile 661-231-5416 work 310-825-9550
      .mac: jdeleeuw +++  aim: deleeuwjan +++ skype: j_deleeuw
===============================================================
(Continue reading)

Daren Tan | 20 Aug 08:34

Understanding output of summary(glm(...))


Simple example of 5 groups of 4 replicates.

>set.seed(5)

>tmp <- rnorm(20)

>gp <- as.factor(rep(1:5,each=4))

>summary(glm(tmp ~ -1 + gp, data=data.frame(tmp, gp)))$coefficients          Estimate Std. Error       t value 
Pr(>|t|)gp1 -0.1604613084  0.4899868 -0.3274809061 0.7478301gp2  0.0002487984  0.4899868 
0.0005077655 0.9996016gp3  0.0695463698  0.4899868  0.1419352018 0.8890200gp4 -0.6121682841 
0.4899868 -1.2493567852 0.2306791gp5 -0.6999545014  0.4899868 -1.4285171713 0.1736348

>m <- data.frame(tmp, gp)
>sapply(gp, function(x) sd(m[m[,"gp"]==x,1])) [1] 1.169284 1.169284 1.169284 1.169284 1.142974
1.142974 1.142974 1.142974 [9] 0.862423 0.862423 0.862423 0.862423 0.535740 0.535740 0.535740
0.535740[17] 1.047538 1.047538 1.047538 1.047538
Why doesn't the standard deviation of each group correlates with the Pr e.g., gp = 4 has the smallest sd of
0.535740, but its Pr is not the lowest (i.e., only 0.23 vs 0.1736 of gp = 5). 

Another example with new tmp1

>tmp1
 [1]  9.577969  9.310792  9.666767  9.610164 10.181692 10.155899 10.025943 [8]  9.971243 10.177766  9.265793 
9.415818 10.099874 10.238829  9.575591[15]  9.560879  9.617891  9.617891 10.158160 10.592377 10.068443

>summary(glm(tmp1 ~ -1 + age, data=data.frame(as.vector(as.matrix(tmp1)), age)))$coefficients     
Estimate Std. Error  t value     Pr(>|t|)age1  9.541423  0.1611603 59.20456 3.380085e-19age2 10.083694 
0.1611603 62.56935 1.479781e-19age3  9.739813  0.1611603 60.43557 2.485380e-19age4  9.748297 
(Continue reading)

phguardiol | 20 Aug 08:30

cmprsk and a time dependent covariate in the model


 Dear R users,

I d like to assess the effect of "treatment" covariate on a disease relapse risk with the package cmprsk. 

However, the effect of this covariate on survival is time-dependent
(assessed with cox.zph): no significant effect during the first year of follow-up,
then after 1 year a favorable effect is observed on survival (step
function might be the correct way to say that ?). 
For overall survival analysis
I have used a time dependent Cox model which has confirmed this positive effect after
1 year.

Now I m moving to disease relapse incidence and a similar time dependency seems to be present. 

what I d like to have is that: for
patients without "treatment" the code for "treatment" covariate is
always 0, and for patients who received "treatment" covariate I d like
to have it = 0 during time interval 0 to 1 year, and equal to 1 after 1
year. Correct me if I m wrong in trying to do so.

First, I have run the following script (R2.7.1 under XPpro) according to previous advices:

library(cmprsk)

attach(LAMrelapse)

fit1<- crr(rel.t, rel.s, treatment, treatment, function(uft)
cbind(ifelse(uft<=1,1,0),ifelse(uft>1,1,0)), failcode=1,
cencode=0, na.action=na.omit, gtol-06, maxiter)
(Continue reading)

Lauri Nikkinen | 20 Aug 08:04

Random sequence of days?

Dear list,

I tried to find a solution for this problem from the archives but
couldn't find any. I would like sample sequence of ten days from
vector d

d <- seq(as.Date("2007-02-12"), as.Date("2008-08-18"), by="days")

so that the days follow each other (sample(d, 10) is not the
appropriate solution). Any ideas?

Best regards,
Lauri

______________________________________________
R-help <at> r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

suman Duvvuru | 20 Aug 06:18

Conversion - lowercase to Uppercase letters

I would like to know how to convert a string with characters to all
uppercase or all lowercase? If anyone could let me know if there exists a
function in R for the conversion, that will be very helpful.

Regards,
Suman

	[[alternative HTML version deleted]]

______________________________________________
R-help <at> r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Gmane