
A Simulated Panel Survey Data
psurvey.RdAn artificially created dataset to demonstrate the use of clustGLMM. It contains data about 500 people (i) each observed random number of times in a span of 20 years. The data were generated by assuming 3 latent groups (g). People in group 1 have lower income (did not finish university) than other two groups. Groups 2 and 3 are similar in income but differ in the attitude, while people in group 2 have more relaxing approach and spend money on trips, people in group 3 work hard on their career and enjoy life less.
Format
psurvey is a data frame with 4512 observations on the following 6 variables
ia numeric vector - id of a person
ja numeric vector - order of observation for a person
agea numeric vector - age of a person when observation taken
incomea numeric vector - income of a person in artificial units
ntripsa numeric vector - number of trips taken in the last year
satisfactionan ordered factor with levels
0<1<2- level of self-evaluated satisfaction with their current lifestyle (0 not satisfied, 1 neither-nor, 2 satisfied)
Additionally, data frame psurvey_latent contains columns that are known from the creation process, but should not be used for analysis:
ia numeric vector - id of a person
ja numeric vector - order of observation for a person
ga numeric vector - a true group label from 1, 2, 3
b_numa numeric vector - true random intercept for
incomeb_poia numeric vector - true random intercept for
ntripsb_orda numeric vector - true random intercept for
satisfaction
Examples
data(psurvey)
head(psurvey)
#> i j age income ntrips satisfaction
#> 1 1 1 18.42013 95.01285 3 0
#> 2 1 2 20.75503 103.02934 0 0
#> 3 1 3 21.42530 108.03323 0 2
#> 4 1 4 25.16883 127.68021 0 1
#> 5 1 5 26.59334 152.50394 1 2
#> 6 1 6 29.77266 160.85054 3 2
summary(psurvey)
#> i j age income
#> Min. : 1.0 Min. : 1.000 Min. :18.00 Min. : 48.71
#> 1st Qu.:125.8 1st Qu.: 3.000 1st Qu.:22.97 1st Qu.:112.32
#> Median :250.0 Median : 5.000 Median :28.95 Median :135.28
#> Mean :250.2 Mean : 5.072 Mean :29.01 Mean :134.36
#> 3rd Qu.:375.2 3rd Qu.: 7.000 3rd Qu.:35.06 3rd Qu.:155.39
#> Max. :500.0 Max. :14.000 Max. :40.00 Max. :213.66
#> ntrips satisfaction
#> Min. : 0.000 0:1340
#> 1st Qu.: 1.000 1:1812
#> Median : 2.000 2:1360
#> Mean : 3.362
#> 3rd Qu.: 4.000
#> Max. :37.000
data(psurvey_latent)
head(psurvey_latent)
#> i j g b_num b_poi b_ord
#> 1 1 1 3 3.083579 -0.3504447 0.1348468
#> 2 1 2 3 3.083579 -0.3504447 0.1348468
#> 3 1 3 3 3.083579 -0.3504447 0.1348468
#> 4 1 4 3 3.083579 -0.3504447 0.1348468
#> 5 1 5 3 3.083579 -0.3504447 0.1348468
#> 6 1 6 3 3.083579 -0.3504447 0.1348468