ranef.jointmeta1: Function to extract estimated random effects

Description Usage Arguments Value See Also Examples

View source: R/ranef.jointmeta1.R

Description

This function extracts the estimated values of the random effects from a supplied jointmeta1 fit.

Usage

1
2
## S3 method for class 'jointmeta1'
ranef(object, type = c("individual", "study"), ...)

Arguments

object

a jointmeta1 object (the result of fitting a model using jointmeta1, see jointmeta1.object)

type

the type of random effects to return. Set type = 'individual' to return the estimates of the individual level random effects. Set type = 'study' to return the estimates of the level random effects if included in the model.

...

additional arguments; currently none are used.

Value

If type = 'individual' then a list of matrices containing the individual level random effects is returned. This list is of length equal to the number of studies in the dataset. Each matrix has number of rows equal to the number of individuals in the corresponding study, and number of columns equal to the number of individual level random effects.

If type = 'study' then if study level random effects are present in the supplied model fit, a matrix of the estimated study level random effects is returned, with number of rows equal to the number of studies in the dataset, and number of columns equal to the number of study level random effects. If study level random effects are requested but are not present in the supplied model fit, an error message is returned.

See Also

jointmeta1, jointmeta1.object, fixef

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
   #change example data to jointdata object
   jointdat2<-tojointdata(longitudinal = simdat2$longitudinal,
   survival = simdat2$survival, id = 'id',longoutcome = 'Y',
   timevarying = c('time','ltime'),
   survtime = 'survtime', cens = 'cens',time = 'time')

   #set variables to factors
   jointdat2$baseline$study <- as.factor(jointdat2$baseline$study)
   jointdat2$baseline$treat <- as.factor(jointdat2$baseline$treat)

   #fit multi-study joint model
   #note: for demonstration purposes only - max.it restricted to 5
   #model would need more iterations to truely converge
   onestagefit<-jointmeta1(data = jointdat2, long.formula = Y ~ 1 + time +
                           + treat + study, long.rand.ind = c('int', 'time'),
                           long.rand.stud = c('treat'),
                           sharingstrct = 'randprop',
                           surv.formula = Surv(survtime, cens) ~ treat,
                           study.name = 'study', strat = TRUE, max.it=5)

    #extract the individual level random effects covariance matrix
    ranef(onestagefit, type = 'individual')

    #extract the study level random effects covariance matrix
    ranef(onestagefit, type = 'study')

Example output

Loading required package: lme4
Loading required package: Matrix
Loading required package: survival
Loading required package: JM
Loading required package: MASS
Loading required package: nlme

Attaching package: 'nlme'

The following object is masked from 'package:lme4':

    lmList

Loading required package: splines
Running EM algorithm...
[1] "Not converged"
Calculating log-likelihood...

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |                                                                      |   1%
  |                                                                            
  |=                                                                     |   1%
  |                                                                            
  |=                                                                     |   2%
  |                                                                            
  |==                                                                    |   2%
  |                                                                            
  |==                                                                    |   3%
  |                                                                            
  |===                                                                   |   4%
  |                                                                            
  |===                                                                   |   5%
  |                                                                            
  |====                                                                  |   5%
  |                                                                            
  |====                                                                  |   6%
  |                                                                            
  |=====                                                                 |   7%
  |                                                                            
  |=====                                                                 |   8%
  |                                                                            
  |======                                                                |   8%
  |                                                                            
  |======                                                                |   9%
  |                                                                            
  |=======                                                               |   9%
  |                                                                            
  |=======                                                               |  10%
  |                                                                            
  |=======                                                               |  11%
  |                                                                            
  |========                                                              |  11%
  |                                                                            
  |========                                                              |  12%
  |                                                                            
  |=========                                                             |  12%
  |                                                                            
  |=========                                                             |  13%
  |                                                                            
  |==========                                                            |  14%
  |                                                                            
  |==========                                                            |  15%
  |                                                                            
  |===========                                                           |  15%
  |                                                                            
  |===========                                                           |  16%
  |                                                                            
  |============                                                          |  17%
  |                                                                            
  |============                                                          |  18%
  |                                                                            
  |=============                                                         |  18%
  |                                                                            
  |=============                                                         |  19%
  |                                                                            
  |==============                                                        |  19%
  |                                                                            
  |==============                                                        |  20%
  |                                                                            
  |==============                                                        |  21%
  |                                                                            
  |===============                                                       |  21%
  |                                                                            
  |===============                                                       |  22%
  |                                                                            
  |================                                                      |  22%
  |                                                                            
  |================                                                      |  23%
  |                                                                            
  |=================                                                     |  24%
  |                                                                            
  |=================                                                     |  25%
  |                                                                            
  |==================                                                    |  25%
  |                                                                            
  |==================                                                    |  26%
  |                                                                            
  |===================                                                   |  27%
  |                                                                            
  |===================                                                   |  28%
  |                                                                            
  |====================                                                  |  28%
  |                                                                            
  |====================                                                  |  29%
  |                                                                            
  |=====================                                                 |  29%
  |                                                                            
  |=====================                                                 |  30%
  |                                                                            
  |=====================                                                 |  31%
  |                                                                            
  |======================                                                |  31%
  |                                                                            
  |======================                                                |  32%
  |                                                                            
  |=======================                                               |  32%
  |                                                                            
  |=======================                                               |  33%
  |                                                                            
  |========================                                              |  34%
  |                                                                            
  |========================                                              |  35%
  |                                                                            
  |=========================                                             |  35%
  |                                                                            
  |=========================                                             |  36%
  |                                                                            
  |==========================                                            |  37%
  |                                                                            
  |==========================                                            |  38%
  |                                                                            
  |===========================                                           |  38%
  |                                                                            
  |===========================                                           |  39%
  |                                                                            
  |============================                                          |  39%
  |                                                                            
  |============================                                          |  40%
  |                                                                            
  |============================                                          |  41%
  |                                                                            
  |=============================                                         |  41%
  |                                                                            
  |=============================                                         |  42%
  |                                                                            
  |==============================                                        |  42%
  |                                                                            
  |==============================                                        |  43%
  |                                                                            
  |===============================                                       |  44%
  |                                                                            
  |===============================                                       |  45%
  |                                                                            
  |================================                                      |  45%
  |                                                                            
  |================================                                      |  46%
  |                                                                            
  |=================================                                     |  47%
  |                                                                            
  |=================================                                     |  48%
  |                                                                            
  |==================================                                    |  48%
  |                                                                            
  |==================================                                    |  49%
  |                                                                            
  |===================================                                   |  49%
  |                                                                            
  |===================================                                   |  50%
  |                                                                            
  |===================================                                   |  51%
  |                                                                            
  |====================================                                  |  51%
  |                                                                            
  |====================================                                  |  52%
  |                                                                            
  |=====================================                                 |  52%
  |                                                                            
  |=====================================                                 |  53%
  |                                                                            
  |======================================                                |  54%
  |                                                                            
  |======================================                                |  55%
  |                                                                            
  |=======================================                               |  55%
  |                                                                            
  |=======================================                               |  56%
  |                                                                            
  |========================================                              |  57%
  |                                                                            
  |========================================                              |  58%
  |                                                                            
  |=========================================                             |  58%
  |                                                                            
  |=========================================                             |  59%
  |                                                                            
  |==========================================                            |  59%
  |                                                                            
  |==========================================                            |  60%
  |                                                                            
  |==========================================                            |  61%
  |                                                                            
  |===========================================                           |  61%
  |                                                                            
  |===========================================                           |  62%
  |                                                                            
  |============================================                          |  62%
  |                                                                            
  |============================================                          |  63%
  |                                                                            
  |=============================================                         |  64%
  |                                                                            
  |=============================================                         |  65%
  |                                                                            
  |==============================================                        |  65%
  |                                                                            
  |==============================================                        |  66%
  |                                                                            
  |===============================================                       |  67%
  |                                                                            
  |===============================================                       |  68%
  |                                                                            
  |================================================                      |  68%
  |                                                                            
  |================================================                      |  69%
  |                                                                            
  |=================================================                     |  69%
  |                                                                            
  |=================================================                     |  70%
  |                                                                            
  |=================================================                     |  71%
  |                                                                            
  |==================================================                    |  71%
  |                                                                            
  |==================================================                    |  72%
  |                                                                            
  |===================================================                   |  72%
  |                                                                            
  |===================================================                   |  73%
  |                                                                            
  |====================================================                  |  74%
  |                                                                            
  |====================================================                  |  75%
  |                                                                            
  |=====================================================                 |  75%
  |                                                                            
  |=====================================================                 |  76%
  |                                                                            
  |======================================================                |  77%
  |                                                                            
  |======================================================                |  78%
  |                                                                            
  |=======================================================               |  78%
  |                                                                            
  |=======================================================               |  79%
  |                                                                            
  |========================================================              |  79%
  |                                                                            
  |========================================================              |  80%
  |                                                                            
  |========================================================              |  81%
  |                                                                            
  |=========================================================             |  81%
  |                                                                            
  |=========================================================             |  82%
  |                                                                            
  |==========================================================            |  82%
  |                                                                            
  |==========================================================            |  83%
  |                                                                            
  |===========================================================           |  84%
  |                                                                            
  |===========================================================           |  85%
  |                                                                            
  |============================================================          |  85%
  |                                                                            
  |============================================================          |  86%
  |                                                                            
  |=============================================================         |  87%
  |                                                                            
  |=============================================================         |  88%
  |                                                                            
  |==============================================================        |  88%
  |                                                                            
  |==============================================================        |  89%
  |                                                                            
  |===============================================================       |  89%
  |                                                                            
  |===============================================================       |  90%
  |                                                                            
  |===============================================================       |  91%
  |                                                                            
  |================================================================      |  91%
  |                                                                            
  |================================================================      |  92%
  |                                                                            
  |=================================================================     |  92%
  |                                                                            
  |=================================================================     |  93%
  |                                                                            
  |==================================================================    |  94%
  |                                                                            
  |==================================================================    |  95%
  |                                                                            
  |===================================================================   |  95%
  |                                                                            
  |===================================================================   |  96%
  |                                                                            
  |====================================================================  |  97%
  |                                                                            
  |====================================================================  |  98%
  |                                                                            
  |===================================================================== |  98%
  |                                                                            
  |===================================================================== |  99%
  |                                                                            
  |======================================================================|  99%
  |                                                                            
  |======================================================================| 100%
[[1]]
           b2_0         b2_1
448  0.97280748  0.440463304
231  1.49356451  0.731818170
163 -0.82060644 -0.287024460
98   0.55883445  0.249557064
174  1.04723283  0.594951634
424  0.37677662  0.306050997
434  1.32211104  0.718529802
4   -0.35735083  0.007339713
1    0.51743544  0.424085531
390 -1.45847125 -0.663216294
480  0.38227003  0.384159013
178  0.40222606  0.362266377
371  0.71309623  0.485856251
300  2.20929454  0.933648412
140 -0.62732126 -0.297485004
3   -0.57491365 -0.261648418
481  1.89504659  0.873067058
54   1.29258935  0.702589460
181  1.81665690  0.796140212
2    0.67706843  0.229221260
263  0.51193739  0.558851773
13   0.63367197  0.530496161
185 -0.52011463  0.142398143
17   1.39608520  0.672448492
81   2.02539380  1.245419692
240  0.10347002  0.376498709
493  1.74625395  0.507762818
461  0.05272625  0.541186055
141 -0.53944667  0.193808185
449  0.16340201  0.862510621
211  0.79783622  1.222794113
243  0.51846282 -0.630587137
138  0.13550561  1.424145254
228 -0.17524909  1.262645555
426  0.16984205  0.497489717
53   0.73253646  0.454945244
158 -0.76501867  1.061314314
46  -0.38355082  1.769012742
436  0.27582469 -0.063416194
470  1.58878257  0.030945323
257  1.00954871 -0.917725465
206 -0.23971040  1.185417097
123  1.06069528  1.552517147
176 -0.56086183 -1.546135644
94   0.36912606  1.200797713
266 -0.07261434  0.799888974
455  1.98759932  0.938427887
295 -0.15876992  0.896191165
375 -0.04237702  0.343732737
256  0.02822275  0.846895343
38   0.29816890  0.020612528
255 -0.94969057  0.051024656
153  0.04044632  0.052671249
68  -1.02074690  1.087863304
147  0.09562556  1.751783228
64  -0.93165735  0.878979022
60  -1.38613348 -0.445272007
271 -0.38977441 -0.216833675
12   0.04022431 -1.081277064
299 -0.19584334  1.589347164
274  0.12244047  0.841891334
468 -2.64163910  0.822066910
269  1.29477827  0.178038612
357 -1.23289283  0.170298056
384 -0.63530034 -0.253701263
409  0.53659127  0.654920830
486 -0.64738173  0.305103131
343 -0.81128278  0.491010597
191  0.10965384 -0.425492207
472 -0.37725531 -0.094266731
30   0.35059064 -1.787348821
356  0.18152077  0.321767903
111 -1.33570098 -0.991076967
238  0.33723649  0.170102085
363 -1.27023330 -0.126942059
445 -0.25000327 -0.038445211
127 -1.29370102 -0.280064770
387 -1.90848041 -2.013620508
22  -0.50910448 -0.451315574
204 -0.71731098 -0.422650066
6    1.05740545 -1.131313064
20   0.03406493 -2.766737716
34  -1.09548290 -1.022227137
42  -1.10287739 -0.956933856
48   0.17314445 -0.875465510
52   0.10696298 -1.561402084
62  -0.53798599 -1.530143425
67  -0.17016385 -1.402620692
71  -0.73616023 -1.061319642
195 -0.54141583 -0.668669377
201 -0.83539402 -1.147704387
245  1.34924555 -0.974618489
332 -1.38839433 -1.529444766
345 -0.34320078 -0.759255928
394 -1.42167826 -0.711749743
408 -1.52959637 -2.358475521
412 -0.09632824 -1.083870601
454 -1.10409371 -1.434240949
474 -0.82674885 -1.494145131
482 -0.61586416 -0.368472734

[[2]]
           b2_0        b2_1
673  0.98127163  0.44379261
838  2.11337959  0.97104710
956  1.64929273  0.79081557
877  1.41354057  0.68584955
527  1.64406515  0.78475647
752  1.24413140  0.61663799
972  0.55423475  0.32232893
795  1.45041878  0.65318938
504  0.85592869  0.46937875
790  0.66104542  0.39332952
591  0.22254895  0.20430033
783  1.90073545  0.97997724
562  0.02082670  0.11470063
529  0.08600560  0.13810879
898 -1.52111369 -0.68940481
754  0.39863693  0.27533141
707 -0.53226135 -0.10845940
550  1.75457077  0.93093397
739 -0.32759726  0.04443502
789  0.79667313  0.38267659
940  0.08700773  0.17487798
781  0.46749602  0.28865192
967 -0.07990993  0.10928895
851  0.45399998  0.26489113
691  0.24897950  0.19325559
948 -0.32746617 -0.15767861
724  0.40662271  0.47929012
796 -0.39619559 -0.18942444
588 -0.10513596  0.14319372
623 -0.95342209 -0.11348080
963 -0.52322630  0.03850432
855  1.39436633  0.91179784
597 -1.25476275 -0.06629408
788 -2.93900610 -1.33167607
521  0.83184864  0.76466638
904  1.10946462 -0.40125641
886 -0.25129354 -0.04850191
952  0.83691061  0.98681593
742  1.09913209  1.14414499
533 -0.25479444  2.27662963
589 -0.68901186  2.44758041
995 -1.33046309 -0.83427140
771  1.18464460  0.91738370
929  0.70529097  0.29210791
801  0.56561251  1.51149442
574  0.29349210  1.32535667
953  1.36359437  0.70186490
571 -1.01062344 -0.93867716
977  0.51280950 -0.68337298
866  1.10848711  1.28729766
815 -0.54260455 -0.51080862
941  0.29946077 -0.01954701
975  0.03521062  1.60441775
564 -0.14938324  1.24302958
878  1.19151280  0.46389758
654 -0.51283912 -0.40894389
957 -0.06439012  1.34266090
825 -0.32628955 -0.15571870
861 -0.15728168  0.47010987
845  0.37384531 -1.05077671
641 -0.72131503  0.33140508
686 -1.34310181 -0.11069933
910  0.62974351 -1.57171197
997 -0.31674113  0.30661988
949 -1.07425238 -1.83018041
664 -0.03519180 -0.02316245
532 -0.30860539  0.46610526
911 -2.14062279 -0.64511071
560  0.62279084 -0.06341037
955 -0.04359098  0.21102446
857 -0.26674256 -2.19683480
541 -1.68461684  0.70690379
993  0.47147748  0.14018076
684  0.66217971 -1.13905393
830 -1.28681820  0.21558275
994 -1.06371392  0.30738946
580 -1.74191174 -2.32319785
937 -0.02165499 -0.04463643
601  1.02788129 -0.51488822
794 -1.23113873 -0.73515965
840  0.69657092 -0.43892828
863 -0.97078501 -0.33393898
842 -0.64485473 -1.44865377
579 -1.64774342 -0.44075068
581 -0.96164930 -2.15242495
594  0.83090200 -1.36751342
605  0.03257842 -0.56833533
631 -2.19212398 -4.23017010
650 -0.89327273 -2.23066373
655 -1.19004306 -2.35020328
669 -1.67959457 -0.56672876
715 -0.49461838 -1.89129881
777 -0.67205493 -2.57396772
779  0.67806749 -2.18330264
816  1.20665622 -0.93908348
916 -2.48724927 -1.07975571
920 -0.33474480 -1.20023065
944 -1.45878725 -2.14874069
973 -1.22106197 -0.33956809
984 -0.91705469 -0.77695034

[[3]]
            b2_0        b2_1
1212  1.54007308  0.69866616
1158 -0.26466924 -0.11814102
1201  2.62842470  1.19805675
1386  1.21048906  0.56480260
1429  1.17136062  0.66194986
1490  0.24740027  0.25944505
1302  1.16443485  0.69333571
1022  0.20669876  0.29633424
1350  0.46143965  0.41990497
1236  2.05881328  0.96519161
1494  1.89226918  0.88409836
1314  0.68783649  0.49902487
1118 -0.35565017 -0.18299782
1433  0.39925509  0.40493812
1052  1.10888461  0.61969315
1170  0.77837441  0.52899058
1291 -0.27811690  0.14837182
1325 -0.48766790  0.07420604
1278  0.11228559  0.29822267
1104 -0.14006727  0.21150314
1243 -0.89947619 -0.44052475
1482  1.19949084  0.88058994
1245  2.68115554  1.31099798
1283  1.35543247  0.99351168
1063  0.86090623  0.81547741
1435  0.66460805  0.40961892
1461  0.17705664  0.33377727
1056 -0.98464588  0.81434972
1029 -0.25168247 -0.73861052
1258  1.73682370  2.67156315
1154 -0.53602091  0.75528720
1181  0.46655087 -0.48927353
1284  0.36952949  1.72270971
1300  0.39732517  3.41844074
1299  0.78862277  1.24575232
1143 -0.07668373  1.37002508
1329 -1.40272530 -0.11731752
1445  1.33363828  0.04408091
1498  0.34946817  1.59271835
1395 -0.13590876  1.37417629
1470  1.20980861  0.67796167
1190 -0.96107655  0.77893261
1366 -0.34923880 -0.04674901
1060  0.62958007  0.89910548
1057 -0.66326561  0.86189276
1361 -1.74277924 -1.33363696
1178  0.21221587  0.45861052
1246 -0.90270140  0.12079899
1210 -0.19412508  1.78115789
1151  0.16855767 -0.73557921
1411 -0.96751074  0.41400673
1226 -0.57148313 -0.22991463
1358  0.55826601  1.30898877
1499  0.39326657  0.90296318
1093  0.90165730  0.44991467
1430 -1.54852186  0.35990569
1014  0.15001535  1.23055936
1021 -0.24306021 -1.75378729
1320  1.65377409 -0.12074692
1094  1.53521780  0.67781364
1033  0.30812624  1.19820562
1100  0.42497142  1.23761468
1171  0.73019619  1.29691601
1338 -0.29072632  0.03980908
1253  0.22601496  0.60912140
1126 -0.67585680 -0.04522838
1164  0.23964385  0.25506334
1204 -1.29345994 -1.00246511
1064 -0.05529486  0.08328771
1129 -0.52049003  1.59298557
1389  0.42938464 -0.17190293
1405 -0.19698356 -0.77725031
1003 -0.55205308  1.08714049
1301 -1.00152713 -1.92329805
1474 -0.28049466  0.58120160
1125  0.94647546  0.60351588
1414 -1.33101320 -0.11508464
1454 -0.67824785 -0.22866857
1108 -0.14052079 -0.93841962
1488 -0.08552454  1.02512150
1495 -1.29407401 -0.12090215
1268 -0.17285813  0.76401072
1426 -0.59647191  0.02276328
1419 -0.71921614  0.47936700
1128  0.35149336 -0.53079633
1394 -0.05415702 -0.16851514
1360 -0.35956392 -0.05609524
1177 -0.24028075  0.35891864
1121 -0.07515633  0.66609564
1035  0.77394296  0.24169561
1085  0.16087372 -0.38884918
1025 -0.53226340 -1.18776986
1080 -0.77841809 -0.30998799
1137 -0.89888273 -1.77654397
1184 -0.78775603 -1.95839196
1217 -2.07354332 -0.57829440
1260 -0.92129707 -1.97157956
1335 -0.41970169 -1.50312168
1407  0.39848605 -1.21748947
1423 -2.20236545 -1.99211612

        b3_0
1  0.4234425
2  0.7906703
3 -1.2138800

joineRmeta documentation built on Jan. 24, 2020, 5:10 p.m.