[R] Joint density approximation?

David Winsemius dwinsemius at comcast.net
Mon Nov 30 18:58:41 CET 2009


On Nov 30, 2009, at 11:20 AM, Trafim wrote:

> Sorry, maybe I confused everybody with what I want.
>
> I have time process X_k, and corresponding returns process R_k
> I am interesting in f(r|x), which I can find knowing f(r,x) and  
> f(x). I know
> the latter I need the first.
>
> How can I apploximate this f(r,x) in the such way that later I can  
> find
> f(X=x,R=r) not for the values from X_k, R_k timeseries, but for some
> predefined grid values.
>

I'm not very current on time series analysis. My hunch (from what  
little I ever knew) is that you are looking for some sort of cross- 
correlation or "transfer function result. Try from the R console:

RSiteSearch('"cross correlation" or "transfer function"')

And also see the Financial and Time Series CRAN Task Views which will  
both turn up highly placed on the obvious Google searches (maybe even  
together as I just observed).

-- 
David

> I looked at the kde2d but it allows only the square matrix + I think  
> from
> this matrix I can only get values f(x,r) in the pairs from (X_k,  
> R_k) but
> not the other I want.
>
> Thanks a lot for any help and suggestions.
>
>
> On Mon, Nov 30, 2009 at 5:09 PM, Trafim <rdapamoga at gmail.com> wrote:
>
>> Also what if the grid matrix is not squared? How can I then find this
>> kernel density matrix/
>>
>> Thanks a lot.
>>
>>
>> On Mon, Nov 30, 2009 at 4:56 PM, Trafim <rdapamoga at gmail.com> wrote:
>>
>>> You are right.
>>> I brought this example just to see how to use its with two time  
>>> series. In
>>> reality I have price process and returns, and I need conditional  
>>> density.
>>>
>>> Will highly appreciate your help.
>>>
>>> I found function kde2d but cannot understand how to call for the  
>>> values of
>>> the matrix.
>>>
>>>
>>>
>>> On Mon, Nov 30, 2009 at 4:48 PM, David Winsemius <dwinsemius at comcast.net 
>>> >wrote:
>>>
>>>>
>>>> On Nov 30, 2009, at 9:30 AM, Trafim wrote:
>>>>
>>>> Unfortunately, it doesn't work.
>>>>> Can you, please, help me with it?
>>>>>
>>>>> In order to support the notion of a 2 dimensional distribution,  
>>>>> you
>>>> need a function that depends on ... 2 dimensions. All you have at  
>>>> the moment
>>>> are two different one-dimensional functions.
>>>>
>>>> What is you goal in this effort?
>>>>
>>>> --
>>>> David.
>>>>
>>>> Thanks a lot.
>>>>>
>>>>> On Mon, Nov 30, 2009 at 2:53 PM, Trafim <rdapamoga at gmail.com>  
>>>>> wrote:
>>>>>
>>>>> Seems that I found it - kde2d
>>>>>>
>>>>>>
>>>>>> On Mon, Nov 30, 2009 at 2:36 PM, Trafim <rdapamoga at gmail.com>  
>>>>>> wrote:
>>>>>>
>>>>>> Hi everybody,
>>>>>>>
>>>>>>> I am looking for the possibility in R to estimate joint  
>>>>>>> density, just
>>>>>>> for
>>>>>>> example:
>>>>>>>
>>>>>>> x <- seq(1,40,1)
>>>>>>> y <- 2*x+1+5*rnorm(length(x))
>>>>>>> y1 <- x^3+.5*rnorm(length(x))
>>>>>>>
>>>>>>> Is there a way to approximate the density function s.t. I will  
>>>>>>> later
>>>>>>> be
>>>>>>> able to calculate f(Y=y, Y1=y1)
>>>>>>>
>>>>>>> Thanks a lot
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>       [[alternative HTML version deleted]]
>>>>>
>>>>>
>>>>> ______________________________________________
>>>>> 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.
>>>>>
>>>>
>>>> David Winsemius, MD
>>>> Heritage Laboratories
>>>> West Hartford, CT
>>>>
>>>>
>>>
>>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> 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.

David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list