Dear Statalist members,
Does anyone know how to interpolate values horizontally? The following data shows that there are one-, two-, three-step-ahead, and so on, up to six-step-ahead forecasts for each time period t. But I have missing values for the four- and five-step-ahead forecast and I need to interpolate the data from the three-step-ahead forecast to the six-step-ahead forecast in every period. The only way I can think of is to transpose them in the Mata and perform the interpolation in Mata. However, I am not quite sure how to do the interpolation in Mata (I'm looking at the mm_interpolate() command). Given that all columns and rows are named numerically when I import the data from Stata using st_data(), I don't know how should I select the variable x and y. Also, the help file of mm_interpolate shows that the new variable is assigned as 1.2 in their example. What does that mean by 1.2?
I would greatly appreciate if anyone could help on this.
Many thanks!
Does anyone know how to interpolate values horizontally? The following data shows that there are one-, two-, three-step-ahead, and so on, up to six-step-ahead forecasts for each time period t. But I have missing values for the four- and five-step-ahead forecast and I need to interpolate the data from the three-step-ahead forecast to the six-step-ahead forecast in every period. The only way I can think of is to transpose them in the Mata and perform the interpolation in Mata. However, I am not quite sure how to do the interpolation in Mata (I'm looking at the mm_interpolate() command). Given that all columns and rows are named numerically when I import the data from Stata using st_data(), I don't know how should I select the variable x and y. Also, the help file of mm_interpolate shows that the new variable is assigned as 1.2 in their example. What does that mean by 1.2?
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(t F1 F2 F3 F4 F5 F6) 2 .1456245 .14484142 .13593246 . . .13580246 3 .143995 .14467934 .1369658 . . .1409643 4 .13837382 .13969778 .13224994 . . .14502968 5 .13785172 .13984114 .13253349 . . .1505979 6 .135864 .13956618 .13360359 . . .1566629 7 .13388118 .13695474 .13053758 . . .1554463 8 .13279217 .13528617 .12972611 . . .15007657 9 .13096268 .13305667 .12814745 . . .14102565 10 .12956016 .13078153 .12464567 . . .13544106 end
Many thanks!
Comment