Dear Users,
I am trying to use the spline interpolation to convert my annual datapoints (company information) to monthly ones in my panel data set (theoretically, it can be done in my specific case - I am aware that it requires assumptions etc.) - however, I am having difficulties conducting it using mata and spline3 options.
A simple extract from my dataset is as follows [firm name not shown]
when using the following code:
use [name of the file]
mata
X = st_data((1,6),"yearstart")
Y = st_data((1,6),"abc")
XX = st_data(.,"date_id")
A = spline3(X,Y)
B = spline3eval(A, XX)
st_store(.,"abc2",B)
end
[saving the dataset]
browse
I am not getting the datapoints for abc2.
I would be grateful if someone could point out my mistake or alternatively suggest a different way of conducting the spline interpolation.
I've tried using the denton function too but since both my annual and monthly datasets are xtset, this didn't work out.
Thank you,
Thomas
I am trying to use the spline interpolation to convert my annual datapoints (company information) to monthly ones in my panel data set (theoretically, it can be done in my specific case - I am aware that it requires assumptions etc.) - however, I am having difficulties conducting it using mata and spline3 options.
A simple extract from my dataset is as follows [firm name not shown]
yearstart | abc | date_id | abc2 |
20111 | 16356000 | 20111 | |
20121 | 114879000 | 20112 | |
20131 | 127693000 | 20113 | |
20141 | 98716000 | 20114 | |
20151 | 85565000 | 20115 | |
20161 | 66861000 | 20116 | |
20117 | |||
20118 | |||
20119 | |||
201110 | |||
201111 | |||
201112 | |||
20121 | |||
20122 | |||
20123 | |||
20124 | |||
20125 | |||
20126 | |||
20127 | |||
20128 | |||
20129 | |||
201210 | |||
201211 | |||
201212 | |||
20131 | |||
20132 | |||
20133 | |||
20134 | |||
20135 | |||
20136 | |||
20137 | |||
20138 | |||
20139 | |||
201310 | |||
201311 | |||
201312 | |||
20141 | |||
20142 | |||
20143 | |||
20144 | |||
20145 | |||
20146 | |||
20147 | |||
20148 | |||
20149 | |||
201410 | |||
201411 | |||
201412 | |||
20151 | |||
20152 | |||
20153 | |||
20154 | |||
20155 | |||
20156 | |||
20157 | |||
20158 | |||
20159 | |||
201510 | |||
201511 | |||
201512 | |||
20161 | |||
20162 | |||
20163 | |||
20164 | |||
20165 | |||
20166 | |||
20167 | |||
20168 | |||
20169 | |||
201610 | |||
201611 | |||
201612 |
use [name of the file]
mata
X = st_data((1,6),"yearstart")
Y = st_data((1,6),"abc")
XX = st_data(.,"date_id")
A = spline3(X,Y)
B = spline3eval(A, XX)
st_store(.,"abc2",B)
end
[saving the dataset]
browse
I am not getting the datapoints for abc2.
I would be grateful if someone could point out my mistake or alternatively suggest a different way of conducting the spline interpolation.
I've tried using the denton function too but since both my annual and monthly datasets are xtset, this didn't work out.
Thank you,
Thomas
Comment