[R] why this function give error message

2008-11-23 Thread saikat sarkar
Dear R guru, I am Saikat Sarkar working as a researcher of Economics in Tampere University, Finland. I am trying to estimate some Garch related tests with Bayesian analysis by R programme. I am not good in R but trying to survive. Anyway I have the coding but not working properly. I

[R] Need some help in R programming code

2008-11-22 Thread saikat sarkar
Dear R guru, I am Saikat Sarkar working as a researcher of Economics in Tampere University, Finland. I am trying to estimate some Garch related tests with Bayesian analysis by R programme. I am not good in R but trying to survive. Anyway I have the coding but not working properly. I have tried

[R] how to manupute data frame with conditions fill cell with previous value if next cell is zero

2008-04-06 Thread saikat sarkar
Dear R Experts, This is the 2nd time in the chat room. Its a great place to get help from R experts. I have a data frame problem, it contains thousands of data. part of it, I am giving for explaining the problem date day x yz 82 1989-04-28 Fri 2118.0 2418.80 33713

Re: [R] how to fit GJR-GARCH model in R

2008-04-04 Thread saikat sarkar
If I understand correct then garch.gjr <- function(par,y,iterate=TRUE) { T<-length(y) mu0<-par[1] a0<-par[2] a1<-par[3] a2 <-par[4] b1 <- par[5] e <- s2 <- numeric(T) s2[1] <- var(y) e[1] <- y[1]-mu0 l<-0 for(t in 2:T) { e[t] <- y[t]-mu0 s2[t] <- a0+a1*e[t-1]^2+b1*s2[t-1] + ifelse(e[t-1

Re: [R] How can we creat conditional data frame

2008-04-04 Thread saikat sarkar
, all=T) res$h <- 0 res$h[is.na(res$price)] <- 1 res$price[is.na(res$price)] <- 0 h<-res$h[-1] h1<-c(h,0) final.data<- data.frame(res$price,h1) final.data<-final.data[final.data$res.price>0,] saikat sarkar wrote: > > Hi, > > R experts. I am a new use

[R] How can we creat conditional data frame

2008-04-04 Thread saikat sarkar
Hi, R experts. I am a new user of R and trying to learn this program. I have a problem. Here is the code. d<-as.Date(c("2000/01/03","2000/01/05","2000/01/19","2000/01/28")) r<-rnorm(4) da<-data.frame(d,r) a<-as.Date("01/01/2000","%d/%m/%Y") b<-as.Date("30/01/2000","%d/%m/%Y") ab<-seq(a,b,by=

[R] How can we creat conditional data frame

2008-04-04 Thread saikat sarkar
Hi, R experts. I am a new user of R and trying to learn this program. I have a problem. Here is the code. d<-as.Date(c("2000/01/03","2000/01/05","2000/01/19","2000/01/28")) r<-rnorm(4) da<-data.frame(d,r) a<-as.Date("01/01/2000","%d/%m/%Y") b<-as.Date("30/01/2000","%d/%m/%Y") ab<-seq(a,b,by=