Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Interpolating missing prices


From   Beatrice Crozza <beatrice.crozza@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Interpolating missing prices
Date   Sun, 24 Jul 2011 08:52:05 +0200

For what I have understood, ipolate interpolates the missing values of
a variable with the values of another one.

In my case, prices are not a function on another variable., so I want
to interpolate only prices.

Bea

2011/7/24, Nick Cox <njcoxstata@gmail.com>:
> Are you asking for -ipolate-?
>
> Nick
>
> On 23 Jul 2011, at 22:45, Beatrice Crozza <beatrice.crozza@gmail.com>
> wrote:
>
>> Dear All,
>>
>> I have a high-frequency price series with many missing values:
>>
>> date                     time      price
>> 26jan2008    83000
>> 26jan2008    83500
>> 26jan2008    84000
>> 26jan2008    84500    100.1
>> 26jan2008    85000
>> 26jan2008    85500
>> 26jan2008    90000
>> 26jan2008    90500
>> 26jan2008    91000    100.14
>> 26jan2008    91500
>> 26jan2008    92000    100.12
>> 26jan2008    92500
>> 26jan2008    93000    100.15
>>
>> I would like to interpolate missing prices with the aritmetic mean of
>> the previous and the next prices to the missing one.
>>
>> I typed:
>> by date: gen price2=(price[_n-1]+price[_n+1])/2 if price[_n]==.
>>
>> however, I receive many missing values as result.
>>
>> How can I ask Stata to use for the interpolation only the available
>> prices, avoiding the missing values?
>>
>>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index