Modify or fill in the values in a series.
Syntax
series_name.adjust [transform] [operator] [values] [interpolation]
Follow the adjust keyword with an expression made up of a combination of transform, operator, values and interpolation components. transform is used to specify a transformation of the data to which the adjustment will be made. The operator contains a mathematical expression defining how you would like to adjust the values in the series. values contains the values used during that operation. Finally, the interpolation component specifies how any missing values in the values component should be filled in via interpolation.
All adjustments are made on the current workfile sample.
Transform
The following transformations are available. If a transformation is specified, any adjustments specified in the operator or interpolation components is made to the transformed data rather than the raw data.
| |
d | One period difference. |
dy | Annual difference. |
pch | One period percentage change. |
pcha | Annualized one period percentage change. |
pchy | Annual percentage change. |
log | Natural logarithm. |
dlog | One period difference of logged values. |
Operators
The following operators are available:
| |
= | Overwrites the existing value with the new value. |
+= | Adds the new value to the existing value. |
-= | Subtracts the new value from the existing value. |
*= | Multiplies the existing value by the new value. |
/= | Divides the existing value by the new value. |
=_ | Overwrites the existing value with the previous cell’s value. |
+_ | Add the new value to the previous observation’s value. |
-_ | Subtract the new value from the previous observation’s value. |
*_ | Multiply the previous observation’s value by the new value. |
/_ | Divide the previous observation’s value by the new value. |
\ | Reverse the order of the observations. Note this operator cannot be used with a values or interpolation component. |
Values
The values component should be made up of a space delimited set of values to use during the adjustment. In addition to single numbers, you may use the following keywords as part of the values component:
| |
. | A single value to be filled in by interpolation. |
# | Use the existing series value, unless it is an NA, in which case fill it by interpolation. |
NA | Insert an NA (which will not be filled by interpolation). |
Rint1[(int2)] | Repeats the previous value int1 times. You may optionally include a second number in parenthesis indicating how many of the previous values to repeat. |
.. | Interpolate between all remaining values. |
Interpolation
The interpolation component specifies how to fill in any missing values in the values component designated for interpolation. By default a cubic spline is used for interpolation. The other available choices are show below.
| |
__ (double underscore) | Repeats previous non-missing value. |
^ | Linear interpolation. |
~ | Cubic spline interpolation |
& | Catmull-Rom spline interpolation. |
^* | Log-linear (multiplicative) interpolation (linear in the log of the data). |
~* | Multiplicative cubic spline interpolation (a cubic spline on the log of the data). |
&* | Multiplicative Catmull-Rom spline interpolation (a Catmull-Rom spline on the log of the data). |
Examples
The following command replaces the first four observations in the current sample of the series UNEMP with the values 2.4, 3.5, 2.9 and 1.4.
unemp.adjust = 2.4 3.5 2.9 1.4
This command modifies the first ten observations in UNEMP, by replacing them with the values: 3.4, 3.15, 2.9, 3.2, 3.5, 3.7, 3.5, 3.7, 3.5, 3.7. Note that the second observation (3.15) has been interpolated, using linear interpolation, between 3.4 and 2.9. Similarly the 4th observation was interpolated between 2.9 and 3.5. Also note that the values 3.5 and 3.7 were repeated three times.
unemp.adjust = 3.4 . 2.9 . 3.5 3.7 R3(2) ^
The following command replaces the log of the first observation in the current sample with 3.4 (setting the raw value equal to exp(3.4) = 29.96). The second observation is left alone (unless it contains an NA, in which case the log value is interpolated). The third observation’s logged value is replaced with 2.2. The log of the penultimate observation in the current sample is replaced with 3.9, and the last observation with 4.8. All observations between the third and the penultimate are interpolated using a cubic spline interpolation method.
unemp.adjust log = 3.4 # 2.2 .. 3.9 4.8
This command adjusts all the observations in the current sample by adding to the existing values. The first observation has 3.4 added to it. The second has 2.9 added to it, and the third has 4.5 added. The last observation has 1.9 added to it. The values added to the observations in between are calculated via a multiplicative Catmull-Rom spline interpolation.
unemp.adjust += 3.4 2.9 4.5 .. 1.9 &*
Cross-references
See
Appendix B. “Enhanced Spreadsheet Editing” and
“Series Adjust” for additional discussion of series adjustment.