pdSize#

Purpose#

Provides size description of a panel dataset including the number of groups, number of time observations for each group.

Format#

{ num_grps, T, balanced } = pdSize(df, groupvar)#
Parameters:
  • df ((N_i*T_i)xK dataframe) – Dataframe containing panel data with (N_i * T_i) rows (observations) and K columns (variables).

  • groupvar (String) – A column vector indicating group membership for panel observations.

Returns:
  • num_grps (Scalar) – Number of groups in the panel.

  • T (Vector) – Containing number of time observations for each group.

  • balanced – Indicator if panel is balanced, report 1 for balanced data, 0 othewise.

Rtype:

Scalar

Examples#

/*
** Example for summarizing panel data
*/
cls;

// Import data
fname = getGAUSSHome("examples/nlswork.dta");
nlswork = loadd(fname);

// Check size of panel
{ num_grps, T, _isbalanced } = pdSize(nlswork, "idcode");

The code above prints the following to screen:

==========================================================================================
Group ID:               idcode                                    Balanced:             No
Valid cases:             13452                                    Missings:          15082
N. Groups:                4711                                  T. Average:          6.057
==========================================================================================

See also:

See also

pdsummary()