Resample from observations in a group.
Syntax
group_name.resample(options) [output_spec]
You should follow the resample keyword with options, and if desired, an output_spec containing a list of names or a wildcard expression identifying the series to hold the output.
• If a output_spec is a list of target series, the number of names must match the number of target series.
• If you provide a wildcard output_spec, the names of the original series will be used along with the wildcard to construct the output series names. You may not use a wildcard if the series in the groups are expressions.
For example, resampling from a group containing the series X(–1) or LOG(X) will produce an error with a wildcard spec since EViews will attempt to append a suffix to the original name, producing an invalid object name.
By default, EViews uses the wildcard spec “*_b” as the output_spec.
Options
outsmpl= smpl_spec | Sample to fill the new series. Either provide the sample range in double quotes or specify a named sample object. The default is the current workfile sample. |
name= group_name | Name of group to hold created series. |
permute | Draw from rows without replacement. Default is to draw with replacement. |
weight= series_name | Name of series to be used containing values proportional to the desired row probabilities (importance sampling). The weight series must have non-missing non-negative values in the input sample, but the weights need not add up to 1, as EViews will normalize the weights. If no weights are provided, rows will be drawn with equal probability weights. |
block=integer | Block length for each draw. Must be a positive integer. The default block length is 1. |
withna (default) | [Draw / Do not draw] from all rows in the current sample, including those with NAs. |
dropna | Do not draw from rows that contain missing values in the current workfile sample. |
fixna | Excludes NAs from draws but copies rows containing missing values to the output series. |
nopanel | Ignore panel structure when resampling. By default, EViews will resample within each cross-section and assign to the corresponding cross-section. |
prompt | Force the dialog to appear from within a program. |
• If the group name specified using “name=” provide already exists and is a group object, the group object will be overwritten. If the object already exists but is not a group object, EViews will error.
• Block bootstrap (“block=” length larger than 1) requires a contiguous output sample. A block length larger than 1 cannot be used together with the “fixna” option, and the “outsmpl=” should not contain any gaps.
• The “fixna” option will have an effect only if there are missing values in the overlapping sample of the input sample (current workfile sample) and the output sample specified by “outsmpl”.
• If you specify “fixna”, we first copy any missing values in the overlapping sample to the output series. Then the input sample is adjusted to drop rows containing missing values and the output sample is adjusted so as not to overwrite the copied values.
• If you choose “dropna” and the block length is larger than 1, the input sample may shrink in order to ensure that there are no missing values in any of the drawn blocks.
• If you choose “permute”, the block option will be reset to 1, the “dropna” and “fixna” options will be ignored (reset to the default “withna” option), and the “weight” option will be ignored (reset to default equal weights).
Examples
group g1 x y
g1.resample
creates new series X_B and Y_B by drawing with replacement from the rows of X and Y in the current workfile sample. If X_B or Y_B already exist in the workfile, they will be overwritten if they are series objects, otherwise EViews will error. Note that only values of X_B and Y_B in the output sample (in this case the current workfile sample) will be overwritten.
g1.resample(weight=wt, name=G2) *_2
will append “_2” to the names for the new series, and will create a group objected named G2 containing these series. The rows in the sample will be drawn with probabilities proportional to the corresponding values in the series WT. WT must have non-missing, non-negative values in the current workfile sample.
Cross-references
See
“Resample” for a discussion of the resampling procedure. For additional discussion of wildcards, see
Appendix A. “Wildcards”.
See also
@resample and
@permute for sampling from matrices.