Skip to contents

Given a time variable and optional covariates, generate predicted values from a cosinor fit. Default prediction is the mean value, optionally can predict at a given month

Usage

# S3 method for class 'cglmm'
predict(object, newdata, ...)

Arguments

object

An object of class cglmm.

newdata

Optional new data.

...

other arguments passed to glmmTMB:::predict.glmmTMB.

Value

Returns predicted values from the cosinor model.

Examples


fit <- cglmm(vit_d ~ X + amp_acro(time,
  group = "X",
  n_components = 1,
  period = 12
), data = vitamind)
predict(fit)
#>   [1] 28.78703 29.38900 39.65854 32.15901 33.23152 31.59434 23.83651 25.61113
#>   [9] 35.22545 30.23427 36.66337 35.07011 26.82297 35.51448 24.51868 31.44631
#>  [17] 30.00428 32.91063 28.62956 23.75660 35.10537 30.11652 33.63770 34.51070
#>  [25] 25.02506 25.25647 31.02807 23.60527 24.18238 39.37434 25.82357 39.59839
#>  [33] 28.24383 31.14539 35.25048 35.38660 23.42314 24.75488 32.49687 23.44897
#>  [41] 39.11973 23.74275 31.59795 23.83684 25.52791 24.60214 27.60858 28.42554
#>  [49] 35.83475 33.66548 36.72509 27.97113 33.23491 24.11054 24.85594 35.93978
#>  [57] 27.03989 24.93989 35.80209 30.54907 35.57847 27.91994 35.08763 23.59721
#>  [65] 28.99433 27.91936 34.94811 24.87614 35.64055 24.63725 27.62906 32.39134
#>  [73] 30.53588 26.22991 24.15941 29.70517 23.46939 29.52667 38.02665 38.71979
#>  [81] 23.62914 26.19743 35.92551 39.52855 31.46970 31.26502 23.80387 33.81262
#>  [89] 29.29779 24.16632 34.81420 35.51270 23.64598 28.25380 27.66860 28.18307
#>  [97] 23.49232 23.52321 27.05249 24.01758 32.66548 34.64841 23.96458 25.41949
#> [105] 32.41430 30.85781 34.78939 35.56505 33.49875 26.00211 27.13928 27.05351
#> [113] 24.50105 31.40588 24.19341 33.02304 28.51051 35.75484 26.79571 25.19660
#> [121] 25.26221 25.78390 28.30832 32.67383 39.09038 36.50282 28.24510 31.81260
#> [129] 35.83743 35.62748 25.21056 23.77412 33.73027 31.82716 29.17194 33.93879
#> [137] 35.28724 24.98276 32.45258 37.68323 28.36229 34.60109 31.45234 30.26220
#> [145] 35.96025 34.00756 27.33207 23.62559 23.82340 39.55556 36.93157 24.42924
#> [153] 33.54382 35.54255 24.52004 31.84621 26.92623 35.15593 31.66329 35.89971
#> [161] 28.54019 39.65296 23.96759 39.34180 38.38550 29.95681 24.85415 24.70597
#> [169] 38.73700 27.30480 27.17846 23.66411 37.66169 26.28374 39.57867 23.60737
#> [177] 25.78763 35.86054 24.56264 32.71904 27.19674 32.93022 23.63372 23.62670
#> [185] 34.29370 33.67407 34.70216 23.64030 32.34732 24.28944 31.90187 26.48566
#> [193] 24.47011 26.37521 26.95760 30.17249 24.55746 35.49054 28.32653 28.48195