Re: [R] Analyzing Intervals between Data

From: jim holtman <jholtman_at_gmail.com>
Date: Sat, 26 Jul 2008 21:09:12 -0400

You need to provide a definition of what the "spell length" is since I am not an economist. Given that you have a list of prices, how do you determine the spell length and then what do you do with the data in each interval? This is what you would have to clarify, at from my point of view, so that we could understand what you want to do with the data. I assume that if you have the data, then there was some manual (automated function in some other language) that did a transformation on the data. Maybe someone else with an economic background can point you in the right direction.

On Sat, Jul 26, 2008 at 8:09 PM, Jia Ying Mei <jiamei_at_princeton.edu> wrote:
> Hi,
>
> The truth is, I really don't have any idea what I want to do code-wise,
> because I'm not familiar with doing this kind of stuff in R.
>
> What I need is the mean and median for the spell length of a price (i.e.
> prices change over time, but what is the mean and median of the length of
> each interval between changes?), see the attached economist pdf file for an
> idea of what data I am trying to get.
>
> So, I have these two text files that I can merge and fill in the missing
> values like so:
>
>> fmt<-"%m/%d/%y"
>> dd<-read.csv("Desktop/R/CDSdate.txt")
>> dd$Date<-as.Date(dd$Date, fmt)
>>library(zoo)
>> data<-read.zoo("Desktop/R/Countrydata.txt", head=T, format=fmt, sep="\t")
>>newdata<-merge(data, zoo(,dd$Date)
>>Finaldata<-na.locf(newdata, fromLast=TRUE)
>
> I need some way after this to find the mean and median of the intervals
> themselves between each price change by country. Looking at the breakdown
> below, that seems to be mean and median of prices within certain intervals
> (not sure though), but that is not what I need.
>
> Attached is the rough code in Stata for those who know Stata and can convert
> into R, but for a different set of data that is formatted the same way. I
> feel like I've come back to square 1, but ANY help would be appreciated,
> thanks! If not clear, I can definitely clarify points.
>
> Jia Ying Mei
>
> PS. I want to do this in R because I know it will be less complicated in R
> and because I don't own Stata.



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. Received on Sun 27 Jul 2008 - 01:15:14 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 27 Jul 2008 - 04:32:29 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive