2000 16 year-long family life sequences built from the retrospective biographical survey carried out by the Swiss Household Panel (SHP) in 2002. Data from TraMineR package.

data(biofam2)

Format

A data.frame containing three columns:

  • id id of individuals (2000 different ids)

  • time age in years where a change occurs

  • state new state.

Source

Swiss Household Panel https://forscenter.ch/projects/swiss-household-panel/

Details

The biofam2 dataset derives from the biofam dataset from TraMineR package. The biofam2 format is adapted to cfda functions. The biofam data set was constructed by Müller et al. (2007) from the data of the retrospective biographical survey carried out by the Swiss Household Panel (SHP) in 2002. The data set contains sequences of family life states from age 15 to 30 (sequence length is 16). The sequences are a sample of 2000 sequences of those created from the SHP biographical survey. It includes only individuals who were at least 30 years old at the time of the survey. The biofam data set describes family life courses of 2000 individuals born between 1909 and 1972.

The eight states are defined from the combination of five basic states, namely Living with parents (Parent), Left home (Left), Married (Marr), Having Children (Child), Divorced: "Parent", "Left", "Married", "Left+Marr", "Child", "Left+Child", "Left+Marr+Child", "Divorced"

References

Müller, N. S., M. Studer, G. Ritschard (2007). Classification de parcours de vie à l'aide de l'optimal matching. In XIVe Rencontre de la Société francophone de classification (SFC 2007), Paris, 5 - 7 septembre 2007, pp. 157–160.

See also

Other datasets: care, flours

Examples

data(biofam2)
head(biofam2)
#>   id time           state
#> 1  1   15          Parent
#> 2  1   24       Left+Marr
#> 3  1   25 Left+Marr+Child
#> 4  1   30 Left+Marr+Child
#> 5  2   15          Parent
#> 6  2   16            Left

plotData(biofam2)


# \donttest{
# It is recommended to increase the number of cores to reduce computation time
set.seed(42)
basis <- create.bspline.basis(c(15, 30), nbasis = 4, norder = 4)
fmca <- compute_optimal_encoding(biofam2, basis, nCores = 2)
#> ######### Compute encoding #########
#> Number of individuals: 2000
#> Number of states: 8
#> Basis type: bspline
#> Number of basis functions: 4
#> Number of cores: 2
#> Method: precompute
#> 
  |                                                  | 0 % elapsed=00s   
  |=============                                     | 25% elapsed=00s, remaining~00s
  |=========================                         | 50% elapsed=00s, remaining~00s
  |======================================            | 75% elapsed=00s, remaining~00s
  |==================================================| 100% elapsed=00s, remaining~00s
#> 
#> DONE in 0.84s
#> ---- Compute U matrix:
#> 
  |                                                  | 0 % elapsed=00s   
  |=====                                             | 10% elapsed=00s, remaining~00s
  |==========                                        | 20% elapsed=00s, remaining~00s
  |===============                                   | 30% elapsed=00s, remaining~00s
  |====================                              | 40% elapsed=00s, remaining~00s
  |=========================                         | 50% elapsed=00s, remaining~00s
  |==============================                    | 60% elapsed=00s, remaining~00s
  |===================================               | 70% elapsed=00s, remaining~00s
  |========================================          | 80% elapsed=00s, remaining~00s
  |=============================================     | 90% elapsed=00s, remaining~00s
  |==================================================| 100% elapsed=00s, remaining~00s
#> 
  |                                                  | 0 % ~calculating  
  |=                                                 | 1 % ~02s          
  |=                                                 | 2 % ~02s          
  |==                                                | 3 % ~02s          
  |==                                                | 4 % ~02s          
  |===                                               | 5 % ~02s          
  |===                                               | 6 % ~02s          
  |====                                              | 7 % ~02s          
  |====                                              | 8 % ~02s          
  |=====                                             | 9 % ~02s          
  |=====                                             | 10% ~02s          
  |======                                            | 11% ~02s          
  |======                                            | 12% ~02s          
  |=======                                           | 13% ~02s          
  |=======                                           | 14% ~02s          
  |========                                          | 15% ~02s          
  |========                                          | 16% ~02s          
  |=========                                         | 17% ~02s          
  |=========                                         | 18% ~01s          
  |==========                                        | 19% ~02s          
  |==========                                        | 20% ~01s          
  |===========                                       | 21% ~01s          
  |===========                                       | 22% ~01s          
  |============                                      | 23% ~01s          
  |============                                      | 24% ~01s          
  |=============                                     | 25% ~01s          
  |=============                                     | 26% ~01s          
  |==============                                    | 27% ~01s          
  |==============                                    | 28% ~01s          
  |===============                                   | 29% ~01s          
  |===============                                   | 30% ~01s          
  |================                                  | 31% ~01s          
  |================                                  | 32% ~01s          
  |=================                                 | 33% ~01s          
  |=================                                 | 34% ~01s          
  |==================                                | 35% ~01s          
  |==================                                | 36% ~01s          
  |===================                               | 37% ~01s          
  |===================                               | 38% ~01s          
  |====================                              | 39% ~01s          
  |====================                              | 40% ~01s          
  |=====================                             | 41% ~01s          
  |=====================                             | 42% ~01s          
  |======================                            | 43% ~01s          
  |======================                            | 44% ~01s          
  |=======================                           | 45% ~01s          
  |=======================                           | 46% ~01s          
  |========================                          | 47% ~01s          
  |========================                          | 48% ~01s          
  |=========================                         | 49% ~01s          
  |=========================                         | 50% ~01s          
  |==========================                        | 51% ~01s          
  |==========================                        | 52% ~01s          
  |===========================                       | 53% ~01s          
  |===========================                       | 54% ~01s          
  |============================                      | 55% ~01s          
  |============================                      | 56% ~01s          
  |=============================                     | 57% ~01s          
  |=============================                     | 58% ~01s          
  |==============================                    | 59% ~01s          
  |==============================                    | 60% ~01s          
  |===============================                   | 61% ~01s          
  |===============================                   | 62% ~01s          
  |================================                  | 63% ~01s          
  |================================                  | 64% ~01s          
  |=================================                 | 65% ~01s          
  |=================================                 | 66% ~01s          
  |==================================                | 67% ~01s          
  |==================================                | 68% ~01s          
  |===================================               | 69% ~01s          
  |===================================               | 70% ~01s          
  |====================================              | 71% ~01s          
  |====================================              | 72% ~01s          
  |=====================================             | 73% ~00s          
  |=====================================             | 74% ~00s          
  |======================================            | 75% ~00s          
  |======================================            | 76% ~00s          
  |=======================================           | 77% ~00s          
  |=======================================           | 78% ~00s          
  |========================================          | 79% ~00s          
  |========================================          | 80% ~00s          
  |=========================================         | 81% ~00s          
  |=========================================         | 82% ~00s          
  |==========================================        | 83% ~00s          
  |==========================================        | 84% ~00s          
  |===========================================       | 85% ~00s          
  |===========================================       | 86% ~00s          
  |============================================      | 87% ~00s          
  |============================================      | 88% ~00s          
  |=============================================     | 89% ~00s          
  |=============================================     | 90% ~00s          
  |==============================================    | 91% ~00s          
  |==============================================    | 92% ~00s          
  |===============================================   | 93% ~00s          
  |===============================================   | 94% ~00s          
  |================================================  | 95% ~00s          
  |================================================  | 96% ~00s          
  |================================================= | 97% ~00s          
  |================================================= | 98% ~00s          
  |==================================================| 99% ~00s          
  |==================================================| 100% elapsed=02s  
#> 
#> DONE in 1.94s
#> ---- Compute encoding: 
#> DONE in 0.01s
#> ---- Compute Bootstrap Encoding:
#> ********
#> Warning: The F matrix contains at least one column of 0s. At least one state is not present in the support of one basis function. Corresponding coefficients in the alpha output will have a 0 value.
#> ****************************************
#> Warning: The F matrix contains at least one column of 0s. At least one state is not present in the support of one basis function. Corresponding coefficients in the alpha output will have a 0 value.
#> **
#> DONE in 0.75s
#> Run Time: 4.43s

plot(fmca, harm = 1)
#> Warning: Removed 162 rows containing missing values or values outside the scale range
#> (`geom_line()`).

plot(fmca, harm = 2)
#> Warning: Removed 162 rows containing missing values or values outside the scale range
#> (`geom_line()`).

plotEigenvalues(fmca, cumulative = TRUE, normalize = TRUE)

plotComponent(fmca, comp = c(1, 2), addNames = FALSE)

# }