Dear all,
I aim to construct a time series of food prices. Hereby, I make the assumption that the price has the same trend regardless of which food product.
Say I have city 1 and prices for products: meat, milk, potatoes, and eggs.
Yet, I have a lot of missing data for the products.
I want to interpolate and extrapolate the prices for the products whereby the interpolation and extrapolation are calculated according to the price change for a product of which I do have observations
Let's consider the following data for city 1
I wish to write a code that exploits the price change of other products to impute the prices of products that have missing values. In this example, the price of bread at t=2 would be ((4-3)/3)*2+2=2.67 as the price of bread at t=1 equals 2 and the price of potatoes goes from 3 to 4 from period t=1 to t=2. Likewise, the price of milk at t=4 would be
([(8-4)/4+(4-4)/4]/2)*2+2=3 as bread goes from 4 to 8 and eggs go from 4 to 4 from period t=3 to t=4.
I would be deeply thankful if anyone can help me in this pursuit.
Thank you in advance!
I aim to construct a time series of food prices. Hereby, I make the assumption that the price has the same trend regardless of which food product.
Say I have city 1 and prices for products: meat, milk, potatoes, and eggs.
Yet, I have a lot of missing data for the products.
I want to interpolate and extrapolate the prices for the products whereby the interpolation and extrapolation are calculated according to the price change for a product of which I do have observations
Let's consider the following data for city 1
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float(city time bread milk potato egg) 1 1 2 1 3 2 1 2 . . 4 . 1 3 4 2 . 4 1 4 8 . 8 4 1 5 . 5 . 5 end
([(8-4)/4+(4-4)/4]/2)*2+2=3 as bread goes from 4 to 8 and eggs go from 4 to 4 from period t=3 to t=4.
I would be deeply thankful if anyone can help me in this pursuit.
Thank you in advance!