@demeanby |

Compute deviations of the mean of series by group.

Syntax: @demeanby(x, g[, s])

x: series

g: series

s: (optional) sample string or object

Return: series

Returns a copy of x after subtracting off group means, where groups are defined by the series or vector g.

EViews will use the current or specified workfile sample.

This function is panel aware.

Examples

The code below produces a graph of a series and its demeaned-by-group form:

wfcreate m 2000 2020

series y = @month + nrnd

group g y @demeanby(y, @month)

g.line

The first line creates a monthly workfile starting in January 2000 and ending in December 2020. The second line generates a series y equal to the month of the year plus normal error. The last two lines graphs y and @demeanby(y, @month) together.

Cross-references