Skip to contents

A svyplan_rotation from design_rotation() is a numeric vector of takes, one entry per period of a unit's life. as.double() gives that vector bare. as.data.frame() lays the pattern out over time as the table of cells plot.svyplan_rotation() draws, one row per interview of every panel in the periods drawn.

Usage

# S3 method for class 'svyplan_rotation'
print(x, ...)

# S3 method for class 'svyplan_rotation'
format(x, ...)

# S3 method for class 'svyplan_rotation'
as.double(x, ...)

# S3 method for class 'svyplan_rotation'
as.data.frame(
  x,
  row.names = NULL,
  optional = FALSE,
  stringsAsFactors = FALSE,
  validRN = TRUE,
  start = c("gradual", "immediate"),
  horizon = NULL,
  panel_plan = NULL,
  ...
)

# S3 method for class 'svyplan_rotation'
x$name

# S3 method for class 'svyplan_rotation'
Ops(e1, e2)

# S3 method for class 'svyplan_rotation'
Math(x, ...)

# S3 method for class 'svyplan_rotation'
x[i] <- value

# S3 method for class 'svyplan_rotation'
x[[i]] <- value

# S3 method for class 'svyplan_rotation'
x$name <- value

Arguments

x

A svyplan_rotation object.

...

Additional arguments are not supported and produce an error.

row.names, optional, stringsAsFactors, validRN

Standard as.data.frame() arguments.

start, horizon, panel_plan

How the first panels enter, the periods covered and an optional n_panel() result, as for plot.svyplan_rotation().

name

Field to extract: spec, life, in_sample, unbroken or equal_take.

e1, e2

Operands. Arithmetic and comparison return bare numerics, since moved takes no longer have the life, standing sample and spec the rotation records.

i, value

Index and replacement value. Replacement is refused: build the pattern you mean with design_rotation().

Value

The method-specific result:

print()

Returns x invisibly.

format()

Returns a string.

as.double()

Returns the take vector.

$

Returns one field of the pattern.

Ops() and Math()

Return bare numerics.

as.data.frame()

Returns one row per interview, ordered by panel and then period, with columns:

period

The period of the interview.

panel

The panel, numbered in the chart's order: under an immediate start the start-up panels first, the one with the shortest remaining life first, then one new panel per period. Each panel here is one cohort, the units at the same wave at every period, so the chart needs no separate cohort column.

entry

The period the panel is selected. A start-up panel whose remaining life starts out of sample is selected in period 1 and first interviewed later.

startup

TRUE for a panel of an immediate start.

rotation_group

The rotation group the panel takes over, as defined on plot.svyplan_rotation().

wave

The place of the interview in the rotation pattern, counting in-sample periods only.

visit

The interview number of the panel. Equal to wave except for a start-up panel.

life_stage

The period of the full life, out-of-sample periods counted.

take

The take at that period, 1 under an equal take.

n

Units interviewed, take times the panel's entrants. Present only when panel_plan is given.

The attributes rotation, start, horizon and full_sample_from, the first period with the full sample in the field, describe the table.

See also

design_rotation(), which builds these objects, plot.svyplan_rotation() for the chart of the cell table, and design_overlap() for the lag profile one produces.

Examples

cps <- design_rotation("4-8-4")
cps
#> Rotation pattern (planning)
#> 
#>   life: 16 periods, 8 in sample each period
#>   rotation: 4 in, 8 out, 4 in
as.double(cps)
#>  [1] 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1

# The fields of the pattern
cps$life
#> [1] 16
cps$in_sample
#> [1] 8
cps$unbroken
#> [1] FALSE

# Arithmetic returns plain takes, never a rotation with stale fields
2 * cps
#>  [1] 2 2 2 2 0 0 0 0 0 0 0 0 2 2 2 2

# The cells of an immediate start: a start-up panel's first interview can
# be at a later wave
cells <- as.data.frame(design_rotation("2-2-2"), start = "immediate",
                       horizon = 8)
head(cells, 8)
#>   period panel entry startup rotation_group wave visit life_stage take
#> 1      1     1     1    TRUE              1    4     1          6    1
#> 2      1     2     1    TRUE              2    3     1          5    1
#> 3      2     2     1    TRUE              2    4     2          6    1
#> 4      2     3     1    TRUE              1    3     1          5    1
#> 5      3     3     1    TRUE              1    4     2          6    1
#> 6      3     4     1    TRUE              2    3     1          5    1
#> 7      4     4     1    TRUE              2    4     2          6    1
#> 8      1     5     1    TRUE              3    2     1          2    1

# Which panels are at their first wave in period 6
subset(cells, period == 6 & wave == 1)
#>    period panel entry startup rotation_group wave visit life_stage take
#> 28      6    11     6   FALSE              1    1     1          1    1