resample |

Resample from rows in a group.

Syntax

group_name.resample(options) output_name

You should follow the resample keyword and options with an output_name containing a name of the matrix to hold the output.

By default, EViews uses the output_name “*_b” so that “_b” will be appended to the name of the original matrix and used as the output name.

Options

rows = n | (Optional) Number of rows of the output matrix. Default is to create an output matrix with the same the number of rows as the source matrix. |

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 matrix, 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 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 matrix, including those with NAs. |

dropna | Do not draw from rows that contain missing values in the matrix. |

fixna | Excludes NAs from draws but copies rows containing missing values to the output matrix. |

prompt | Force the dialog to appear from within a program. |

• Block bootstrap (“block=” length larger than 1) requires a contiguous output. Therefore a block length larger than 1 cannot be used together with the “fixna” option.

• The “fixna” option will have an effect only if there are missing values in the rows of the source matrix.

• If you specify “fixna”, we first copy rows with any missing values in the matrix sample to the output matrix (if relevant). Then the remaining rows of the output matrix will be resampled from the remaining rows of the input matrix.

• If you choose “dropna” and the block length is larger than 1, the rows of the matrix used for simulation may adjust 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

matrix(100, 5) f

nrnd(f)

f.resample(n = 1000) f_resample

creates a new matrix F_RESAMPLE obtained by drawing 1000 rows with replacement from F.

f.resample(weight=wt) f_weighted

will compute a weighted resample and save the results to the same sized matrix F_WEIGHTED. The rows in the source will be drawn with probabilities proportional to the corresponding values in the series WT. WT must have the same number of rows as F and must contain 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”.