Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Missing values-Times series


From   Philipp Rehm <[email protected]>
To   [email protected]
Subject   Re: st: Missing values-Times series
Date   Tue, 29 Aug 2006 21:35:33 +0200

You may want to use -ipolate-.

Example:

clear
input	Day	Y_observed	Y_Inferred
1	10	10
2	.	25
3	50	50
4	.	50
5	50	50
6	.	40
7	.	30
8	20	20
9	40	40
end

ipolate  Y_observed  Day , generate(Y_ipolate)

list
     +--------------------------------------+
     | Day   Y_obse~d   Y_Infe~d   Y_ipol~e |
     |--------------------------------------|
  1. |   1         10         10         10 |
  2. |   2          .         25         30 |
  3. |   3         50         50         50 |
  4. |   4          .         50         50 |
  5. |   5         50         50         50 |
     |--------------------------------------|
  6. |   6          .         40         40 |
  7. |   7          .         30         30 |
  8. |   8         20         20         20 |
  9. |   9         40         40         40 |
     +--------------------------------------+

(Note that your value for Y_Inferred for Day 2 is probably wrong).

HTH,
Philipp


Inamo, Jocelyn F. M.D., Ph.D. wrote:
Dear STATA Users

I would like to fill the missing values in my time series data shown in the first table, assuming that there is a linear progression between the observed proxy values. Accordingly, I would like to obtain inferred values of Y as shown in the second table.


X Y 1 10 2 3 50 4 5 50 6 7 8 20 9 40


Day Y observed Y Inferred 1 10 10 2 25 3 50 50 4 50 5 50 50 6 40 7 30 8 20 20 9 40 40


The most accurate way to do this would be to go to each missing value and to compute a linear equation within the proxy values of Y. I realized that it was more easy to say than to do (for me at least).

The second way would be to use the smoothing commands of stata. I realized that ksm-lowess work pretty well when set with the smallest bandwidth possible, but I have been unable to recover the inferred values of Y.

Any suggestion?

Thanks
Jocelyn


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index