[R] RBloomberg Multi-ticker problem

2006-11-21 Thread Shubha Vishwanath Karanth
Hi,

 

I am trying to download data from Bloomberg through R. If I try to
download intraday data for multiple tickers and only one field, I get
the error, written below in red. How do I get rid of this error?

 

 

> dat<-blpGetData(conn, c("NOK1V FH Equity","AUA AV Equity"),
"LAST_PRICE",
start=as.chron(as.Date("2006-9-13","%Y-%m-%d")),barfields="VOLUME",
barsize=10,retval="data.frame")

Error in if (typ[n] == "character") { : missing value where TRUE/FALSE
needed

*   blpDisconnect(conn)

 

Thank you,

Shubha.


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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.


[R] questions about garchFit

2006-11-21 Thread T Mu
 Hi all,

I was trying garchFIt() of fSeries to fit volatility of monthly log returns
of S&P500. I tried residuals of normal, student t, skew normal, skew t. But
all innovations except normal got exaxtly same coefficients, even if I
changed their parameters of skew and shape.

Is this correct for the data or something wrong? I am attaching the code,
thank you.

Muster

#GARCH analysis of monthly return
rm(list=ls(all=TRUE))
sp500 <- read.csv('s&p_m.csv', header=TRUE)
sp500 <- sp500[,2] #only adjusted close
n <- length(sp500)

logr <- log(sp500[1:n-1] / sp500[2:n])
acf(logr)
ar5 <- arima(logr, order = c(5, 0, 0), include.mean = T)
logr<- ar5$res #remove mean
acf(logr)

#fit GARCH distribution
hist(logr, freq = F, ylim = c(0, 12), breaks = 'FD')

norm_fit <- normFit(logr)
curve(dnorm(x, norm_fit$est[1], norm_fit$est[2]), -.15, .15, add = TRUE,
col=2)

t_fit <- stdFit(logr)
curve(dstd(x, t_fit$est[1], t_fit$est[2], t_fit$est[3]), -.15, .15, add =
TRUE, col=6)

snorm_fit <- snormFit(logr)
curve(dsnorm(x, snorm_fit$est[1], snorm_fit$est[2], snorm_fit$est[3]), -.25,
.15, add = TRUE, col=4)

st_fit <- sstdFit(logr)
curve(dsstd(x, st_fit$est[1], st_fit$est[2], st_fit$est[3], st_fit$est[4]),
-.25, .15, add = TRUE, col=3)

library(fSeries)

#normal innovation
garch_norm <- garchFit(series = logr, include.mean = F)

#t inovation
garch_t <- garchFit(series = logr, cond.dist = 'dstd', include.mean = F,
include.shape = T)
garch_t1 <- garchFit(series = logr, cond.dist = 'dstd', include.mean = F,
shape = t_fit$est[3], include.shape = T)

#skew normal innovation
garch_snorm <- garchFit(series = logr, cond.dist = 'dsnorm', include.mean =
F, include.skew = T)
garch_snorm1 <- garchFit(series = logr, cond.dist = 'dsnorm', include.mean =
F, skew = snorm_fit$est[3], include.skew = T)

#skew t innovation
garch_st <- garchFit(series = logr, cond.dist = 'dsstd', include.mean = F,
include.skew = T, include.shape = T)
garch_st1 <- garchFit(series = logr, cond.dist = 'dsstd', include.mean = F,
skew = st_fit$est[4], shape = st_fit$est[3], include.skew = T, include.shape= T)

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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.