Skip to contents

Display and coercion methods for the object n_panel() and prec_panel() return. print() gives the number to recruit, the responding sample it is expected to leave, the precision at the target and the wave-by-wave table. summary() adds what the design implies around that answer: the standing sample a rotating design holds, the response and retention it assumes, where the life's loss falls, and the start-up a design passes through on its way to equilibrium. The coercions return the recruitment count, which is a number of units to release and not the analysis sample. Those differ by the whole of the panel's attrition, and it is why svyplan_panel is a sibling of svyplan_n rather than a subtype.

Usage

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

# S3 method for class 'svyplan_panel'
summary(object, ...)

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

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

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

# S3 method for class 'svyplan_panel'
as.integer(x, ...)

# S3 method for class 'svyplan_panel'
as.data.frame(
  x,
  row.names = NULL,
  optional = FALSE,
  stringsAsFactors = FALSE,
  validRN = TRUE,
  ...
)

Arguments

x

A svyplan_panel object, or the summary.svyplan_panel object summary() returns.

...

Additional arguments are not supported and produce an error.

object

A svyplan_panel object.

row.names, optional, stringsAsFactors, validRN

Standard as.data.frame() arguments.

Value

The method-specific result:

print()

Returns its argument invisibly.

summary()

Returns a summary.svyplan_panel object carrying the plan, full wave table, the table by period, and the visits in sample at each period.

format()

Returns a string.

as.double()

Returns the recruitment count.

as.integer()

Returns the whole units to which the recruitment count rounds up.

as.data.frame()

Returns the wave table.

See also

n_panel() and prec_panel(), which build these objects, and print.svyplan_schedule() for the operational schedule a rotating plan becomes.

Examples

plan <- n_panel(
  n_prop(p = 0.5, moe = 0.031),
  retention = c(0.878, 0.963, 0.936, 0.956),
  resp_rate = 0.728
)
plan
#> Panel recruitment (fixed, 5-wave life)
#> issued: 1815 -> 1000 responding at wave 5
#> proportion (wald): se = 0.01581, moe = 0.03099, cv = 0.0316
#> 
#>  wave retention n_resp se      moe    
#>  1              1321   0.01376 0.02696
#>  2    0.878     1160   0.01468 0.02877
#>  3    0.963     1117   0.01496 0.02932
#>  4    0.936     1046   0.01546 0.03031
#>  5    0.956     1000   0.01581 0.03099
#> 
#> # summary() for the start-up, the loss and per-wave cv
summary(plan)
#> Analysis of a panel recruitment (fixed, 5-wave life)
#> 
#> issued: 1815 -> 1000 responding at wave 5
#> rates: response 0.728, retention 0.878 to 0.963 (61% of the loss at wave 1)
#> proportion (wald): se = 0.01581, moe = 0.03099, cv = 0.0316
#> 
#> Waves of the life
#>  wave retention q      loss   n_resp se      moe     cv     cases
#>  1              0.728  0.606  1321   0.01376 0.02696 0.0275 661  
#>  2    0.878     0.6392 0.198  1160   0.01468 0.02877 0.0294 580  
#>  3    0.963     0.6155 0.0526 1117   0.01496 0.02932 0.0299 559  
#>  4    0.936     0.5761 0.0877 1046   0.01546 0.03031 0.0309 523  
#>  5    0.956     0.5508 0.0564 1000   0.01581 0.03099 0.0316 500  

# A rotating design reaching equilibrium: the table by period shows the
# start-up before it gets there
rot <- n_panel(
  n_prop(p = 0.5, moe = 0.031),
  retention = c(0.878, 0.963, 0.936, 0.956),
  resp_rate = 0.728,
  design = "rotating",
  start = "immediate"
)
summary(rot)$periods
#>   period entrants in_sample n_resp      se     moe     cv equilibrium
#> 1      1     1610      1610   1172  0.0146 0.02862 0.0292       FALSE
#> 2      2      322      1610   1058 0.01537 0.03013 0.0307       FALSE
#> 3      3      322      1610   1035 0.01554 0.03046 0.0311       FALSE
#> 4      4      322      1610   1009 0.01574 0.03084 0.0315       FALSE
#> 5      5      322      1610   1001  0.0158 0.03097 0.0316        TRUE
#> 6      6      322      1610   1001  0.0158 0.03097 0.0316        TRUE
summary(rot)$composition
#>    period visit  n_issued    n_resp
#> 1       1     1 1606.8361 1169.7767
#> 2       2     1  321.3672  233.9553
#> 3       2     2 1285.4689  821.6511
#> 4       3     1  321.3672  233.9553
#> 5       3     2  321.3672  205.4128
#> 6       3     3  964.1016  593.4375
#> 7       4     1  321.3672  233.9553
#> 8       4     2  321.3672  205.4128
#> 9       4     3  321.3672  197.8125
#> 10      4     4  642.7344  370.3050
#> 11      5     1  321.3672  233.9553
#> 12      5     2  321.3672  205.4128
#> 13      5     3  321.3672  197.8125
#> 14      5     4  321.3672  185.1525
#> 15      5     5  321.3672  177.0058
#> 16      6     1  321.3672  233.9553
#> 17      6     2  321.3672  205.4128
#> 18      6     3  321.3672  197.8125
#> 19      6     4  321.3672  185.1525
#> 20      6     5  321.3672  177.0058

as.integer(plan)
#> [1] 1815
as.data.frame(plan)
#>   wave retention         q loss_share    n_resp         se        moe
#> 1    1        NA 0.7280000 0.60550724 1320.8645 0.01375754 0.02696429
#> 2    2     0.878 0.6391840 0.19771592 1159.7190 0.01468228 0.02877675
#> 3    3     0.963 0.6155342 0.05264754 1116.8094 0.01496168 0.02932436
#> 4    4     0.936 0.5761400 0.08769657 1045.3336 0.01546474 0.03031033
#> 5    5     0.956 0.5507898 0.05643274  999.3389 0.01581662 0.03100000
#>           cv expected_cases
#> 1 0.02751509       660.4322
#> 2 0.02936457       579.8595
#> 3 0.02992337       558.4047
#> 4 0.03092947       522.6668
#> 5 0.03163323       499.6695