Resample from observations in a vector.
Syntax
vector_name.resample(options) [output_spec]
You should follow the resample keyword and options and an output_spec containing a list of names or a wildcard expression identifying the series to hold the output. If a list is used to identify the targets, the number of target series must match the number of names implied by the keyword.
Options
permute | Draw from rows without replacement. Default is to draw with replacement. |
weight= vector_name | Name of vector to be used for weighted sampling, containing values proportional to the desired row probabilities (importance sampling). The weight vector must have the same number of rows as the source, with non-missing, non-negative values. The weight values need not add up to 1, as EViews will normalize the weights. If no weights are specified, rows will be drawn with equal probability weights. |
block=integer (default = 1) | 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. |
prompt | Force the dialog to appear from within a program. |
• Block bootstrap (block length larger than 1) requires a continuous output sample. Therefore 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
vec1.resample vec1_b
creates a new vector VEC1 by drawing with replacement from the rows of VEC1 in the current workfile sample. If VEC1_B already exists in the workfile and is a vector object, it will be overwritten. If VEC1_B exists and is not a vector, EViews will error.
vec1.resample(weight=wt, suffix=_2) vec1_c
The rows in the source vector will be drawn from with probabilities proportional to the corresponding values in the WT vector. WT must have the same number of rows as VEC1 and must have non-missing, non-negative values.
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.