[R] Help with a Loop in function

2009-11-04 Thread Ricardo Gonçalves Silva
Dear Users, I follow Andreas idea to simulate an ar(1) model with a new kind of innovation process. The new argument rand.gen, for the arima.sim function, I'm trying to generate as: tGarchGen <- function(a, b, c) { # must return a vector of random deviates (eta(t)) for (t in 1:100){ z(t

Re: [R] help with a loop (coefficients with lmList)

2009-08-09 Thread Gabor Grothendieck
Your data has 2 points per regression for each year in industry 1 and only one point per regression for the other industries so one would expect many NAs: > table(data[c("industry", "year")]) year industry 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 122222

[R] help with a loop (coefficients with lmList)

2009-08-09 Thread Cecilia Carmo
Hi R-helpers. #I start with the reproducible example: firm<-c(rep(1,10),rep(2,10),rep(3,10),rep(4,10),rep(5,10)) year<-c(rep(1998:2007,5)) industry<-c(rep(1,20),rep(5,10),rep(7,10),rep(9,10)) X1<-rnorm(50) X2<-rnorm(50,mean=0.5,sd=0.1) Y<-rnorm(50,mean=0,sd=0.5) data<-data.frame(firm, industry,ye

Re: [R] Help with a loop

2008-07-28 Thread Sofia Martinez
HI the code is suppose to generate a random value selected uniformly as a time interval in seconds (that's the dT) from the range given fromdtmin<-969 dtmax<-9884. Once that value is selected the program will generate the interval (ts1, ts2, and so on. for each sampling without getting out o

Re: [R] Help with a loop

2008-07-28 Thread Patrick Burns
You are right to be dissatisfied with your code. I suspect you will get more response if you say what the code is supposed to do, and give a smaller example of what the answer should be. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and "A Guide

[R] Help with a loop

2008-07-27 Thread Sofia Martinez
HI: I need ideas on how to make this code shorter (maybe with a second loop?). The code as it is works, but in this case I only have 14 samples, but it will become insane with more, so I need a way to make it more automatic. The problem is that the output from ts1, ts2, and so on is a vector with m

Re: [R] Help with a Loop

2007-12-03 Thread Gabor Grothendieck
There are three ways listed here: https://stat.ethz.ch/pipermail/r-help/2007-May/132866.html On Dec 2, 2007 5:33 PM, stathelp <[EMAIL PROTECTED]> wrote: > > I am having trouble getting a loop to work for the following problem. Any > help would be much appreciated. Thanks. > > I need to find the sl

Re: [R] Help with a Loop

2007-12-03 Thread Dimitris Rizopoulos
[EMAIL PROTECTED]> To: Sent: Sunday, December 02, 2007 11:33 PM Subject: [R] Help with a Loop > > I am having trouble getting a loop to work for the following > problem. Any > help would be much appreciated. Thanks. > > I need to find the slope and intercept from the linear regress

[R] Help with a Loop

2007-12-03 Thread stathelp
I am having trouble getting a loop to work for the following problem. Any help would be much appreciated. Thanks. I need to find the slope and intercept from the linear regression of Drug Level on Day by Participant. There are a total of 37 Participants. I need to store the Participant, Label, Sl