apaImputation.Mean.Crosssection.Category(DataMatrix, CategoryLabels, MaxGapSize)
=apaImputation.Mean.Crosssection.Category(DataMatrix, CategoryLabels, MaxGapSize)Result
Handles missing observations by replacing them with the cross-sectional mean of the series in the same category with observations.
Syntax
DataMatrix: data matrix; missing elements must be non-numerical
CategoryLabels: 1 x n vector with category labels
MaxGapSize: maximum gap size to fill in
Remarks
A missing (non-numeric) element is replaced by the mean of the numeric values of all series in the same category in that row if the run of consecutive missing elements containing it is at most MaxGapSize long. Runs at the start or end of a series count as gaps as well. Existing values are kept. If no series of the category has a value in that row, #N/A is returned. CategoryLabels may be a row or a column vector with one label per column of DataMatrix.
