Re: [R] Three most useful R package

2010-03-03 Thread ivan popivanov
1) quantmod, zoo, xts, TTR in no particular order, the first requires the others, so I can't really separate them. 2) There are plenty of packages for my needs (using R as a hobbyist), but my biggest concern is that they lack active support. A package for complex testing of trading strategies

[R] A random number from any distribution?

2009-12-13 Thread ivan popivanov
Hello, I have some data, and I want to generate random numbers following the distribution of this data (in other words, to generate a synthetic data sets having the stats of a give data set). Reading an old thread I found the following text: >If you can compute the quantile function of

[R] A random number from any distribution?‏

2009-12-13 Thread ivan popivanov
Hello, I have some data, and I want to generate random numbers following the distribution of this data (in other words, to generate a synthetic data set sharing the same stats as a given data set). Reading an old thread I found the following text: >If you can compute the quantile function o

Re: [R] Need help to complete missing value (Date and Time) in Sp500 Data

2009-12-13 Thread ivan popivanov
Hi Hamid, Not sure why would you need missing data, but you can definitely generate it:). A few random thoughts: First, you can generate all possible timestamps from the beginning to the end of the interval (skipping weekends and skipping the stamps when the markets are closed). Then for

Re: [R] Need help to complete missing value (Date and Time) in Sp500 Data

2009-12-13 Thread ivan popivanov
I > saw that the holidays make trouble and the only what I must do is compare > and remov. > > > > Thanks. > > > ivan popivanov wrote: > > > > > > Hi Hamid, > > > > Not sure why would you need missing data, but you can definitely ge

Re: [R] A random number from any distribution?þ

2009-12-14 Thread ivan popivanov
he question of interest? > > Bert Gunter > Genentech Nonclinical Biostatistics > > > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of Greg Snow > Sent: Monday, December 14, 2009 12:45 PM > To: ivan

Re: [R] Read dataset in R language.

2009-12-15 Thread ivan popivanov
Hi Nancy, testset.txt is using ";" as a field separator instead of the default ",", thus, you need to pass this information to R: tt = read.csv("testset.txt", sep=";") Hope this helps, Ivan > From: nancyada...@hotmail.com > To: r-help@r-project.org > Date: Wed, 16 Dec 2009 02:34:25

Re: [R] as.xts convert all my numeric data to character

2009-12-19 Thread ivan popivanov
Here is what worked for me: 1) Create a single xts object using one column and the index 2) Merge with the other columns tt = read.csv("c:/ttt/totalpc.csv", skip=1) xx = xts(tt$Call, order.by=as.Date(tt$Trade_date, format="%m/%d/%Y")) yy = merge(xx, tt$Put, tt$Total, tt$P.C.Ratio) coln

Re: [R] Dynamic file / url name with read.csv

2010-01-13 Thread ivan popivanov
A few packages have support for basic download from Yahoo Finance. If that's what you are trying to achieve - you may want to try quantmod (getSymbols function) or tseries (get.hist.quote function). If you want to do something not supported yet - first take a look at their source code. Regards

[R] How to convert character matrix or data.frame to numeric?

2010-01-17 Thread ivan popivanov
Hello, This turned out to be surprisingly hard for me: Let's say I have mm = matrix(as.character(seq(1,30, 1)), nrow=3); mm [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] "1" "4" "7" "10" "13" "16" "19" "22" "25" "28" [2,] "2" "5" "8" "11" "14" "17" "20" "23" "26"

[R] How to use geom_line (from ggplot) with aesthetics in a function?

2013-01-02 Thread Ivan Popivanov
Hello, I have been struggling with this for a while, tried a few things, but no clean solution so far. Here is an example from the documentation for geom_line: == # Summarise number of movie ratings by year of movie mry <- do.call(rbind, by(movies, round(mo

[R] Isn't aggreate.zoo supposed to work with POSIXct (zoo/TTR/xts issue)?

2010-05-17 Thread ivan popivanov
library(xts) library(TTR) ndx = getYahooData("^NDX") aa = ndx$Close bb = aggregate(aa, as.yearweek, tail, 1) The last operation takes forever, and then the bb dates are messed up. The following produces the desired result: time(aa) = as.Date(time(aa)) bb = aggregate(aa, as.yearweek, tail, 1)

Re: [R] How to get the closing price from the the GOOGLE FINANCE site for NSEINDIA stocks

2010-06-05 Thread ivan popivanov
Try getSymbols("RCOM.NS", from="1900-01-01") instead. It looks like google has removed the ability to download csv (not much business providing it;)). In any case, Yahoo historical prices go way back than googles. For instance, getSymbols("^DJI", from="1900-01-01") ; head(get("DJI")) shows the

[R] How to determine the quantile boundary from an ECDF?

2011-02-10 Thread Ivan Popivanov
Given a dataset x, the ecdf is ecdf(x). Then I can use ecdf(x)(y) to find the percentile of y. Given the ecdf is there a way to determine what is the value of y that is the boundary of let's say 95 percentile? In other words, is there a function I can call on the ecdf like: fomeFunc( ecdf( x ), 0.

[R] rugarch package: is this forecast correct?

2011-12-05 Thread Ivan Popivanov
Let me start with the code: library(quantmod) library(rugarch) getSymbols("SPY", from="1900-01-01") rets=na.trim(diff(log(Cl(SPY tt = tail(rets["/2004-10-29"], 1000) spec = ugarchspec(variance.model=list(garchOrder=c(1,1)), mean.model=list(armaOrder=c(2,5)), distribution.model="sged") for(ii i