This function computes predictions and optionally the estimated standard errors
of those predictions from a model fitted with maxlogLreg
.
Arguments
- object
an object of
maxlogL
class generated bymaxlogLreg
function.- parameter
a character which specifies the parameter to predict.
- newdata
a data frame with covariates with which to predict. It is an optional argument, if omitted, the fitted linear predictors or the (distribution) parameter predictions are used.
- type
a character with the type of prediction required. The default (
type = "link"
) is on the scale of the linear predictors; the alternativetype = "response"
is on the scale of the distribution parameter.- se.fit
logical switch indicating if standard errors of predictions are required.
- terms
A character vector that specifies which terms are required if
type = "terms"
. All terms are returned by default.- ...
further arguments passed to or from other methods.
Value
If se.fit = FALSE
, a vector of predictions is returned.
For type = "terms"
, a matrix with a column per term and an attribute "constant"
is returned.
If se.fit = TRUE
, a list with the following components is obtained:
fit
: Predictions.se.fit
: Estimated standard errors.
Details
This predict
method computes predictions for values of any
distribution parameter in link or original scale.
Note
Variables are first looked for in newdata
argument and then searched
in the usual way (which will include the environment of the formula used in
the fit). A warning will be given if the variables found are not of the same
length as those in newdata
if it is supplied.
Author
Jaime Mosquera Gutiérrez, jmosquerag@unal.edu.co
Examples
library(EstimationTools)
#--------------------------------------------------------------------------------
# Example 1: Predictions from a model using a simulated normal distribution
n <- 1000
x <- runif(n = n, -5, 6)
y <- rnorm(n = n, mean = -2 + 3 * x, sd = exp(1 + 0.3* x))
norm_data <- data.frame(y = y, x = x)
# It does not matter the order of distribution parameters
formulas <- list(sd.fo = ~ x, mean.fo = ~ x)
norm_mod <- maxlogLreg(formulas, y_dist = y ~ dnorm, data = norm_data,
link = list(over = "sd", fun = "log_link"))
predict(norm_mod)
#> 1 2 3 4 5
#> 6.564803878 5.278157575 -15.383347190 3.491832468 7.909495683
#> 6 7 8 9 10
#> 6.592256400 4.267222855 -4.269583967 10.339097068 8.647706881
#> 11 12 13 14 15
#> -14.595737655 -12.289609538 -10.013256118 -11.679407923 -4.666157168
#> 16 17 18 19 20
#> 14.869830651 -5.093636748 -8.571623493 -13.096967969 -6.729411623
#> 21 22 23 24 25
#> 13.089776998 -10.120461170 -0.454301018 -7.965530457 13.375901605
#> 26 27 28 29 30
#> 5.501822003 -2.484275965 3.680694199 0.567329613 2.342044113
#> 31 32 33 34 35
#> 5.463868114 -4.294990600 14.512651266 -2.378258966 -15.179627706
#> 36 37 38 39 40
#> 14.009089815 13.533859607 9.841686628 -8.251931211 1.967317665
#> 41 42 43 44 45
#> 16.011143184 -4.613650417 -0.548611796 -14.792130110 -14.016854408
#> 46 47 48 49 50
#> -9.304499111 -13.407533243 -3.135574934 8.273548003 12.314097862
#> 51 52 53 54 55
#> -11.479087469 -1.282697274 -11.150399333 -6.439203415 -7.978096746
#> 56 57 58 59 60
#> 12.249701467 -4.110822546 -16.043232720 3.034048269 14.627057679
#> 61 62 63 64 65
#> -6.260619663 -8.135169905 3.993012056 -15.941734313 -3.070053621
#> 66 67 68 69 70
#> -16.778138991 -7.591143858 11.492833532 -2.476038892 13.540042530
#> 71 72 73 74 75
#> -12.804276968 15.345683024 -10.789175498 12.877100423 7.039218609
#> 76 77 78 79 80
#> 8.358749550 11.935103839 2.059245465 15.486999815 6.532593242
#> 81 82 83 84 85
#> 2.549729080 13.423651590 -10.441957585 5.366510756 -7.894474533
#> 86 87 88 89 90
#> -3.170386217 -5.468793396 -13.194916363 7.215464648 15.490402254
#> 91 92 93 94 95
#> -9.217017530 -13.354345578 13.341510463 2.690655077 -5.180410431
#> 96 97 98 99 100
#> -0.943329438 -11.929749182 13.172541824 2.344652929 12.414134411
#> 101 102 103 104 105
#> -3.303512262 7.744992110 -12.786423092 12.845427381 0.799472125
#> 106 107 108 109 110
#> -0.145612011 1.700990382 5.120415491 -13.786802577 7.305630177
#> 111 112 113 114 115
#> 9.672564998 13.186428233 1.560784287 12.596499191 -2.983617678
#> 116 117 118 119 120
#> -9.115647478 11.399451514 -7.400378458 -11.604229774 14.258172129
#> 121 122 123 124 125
#> 3.571966113 11.373951964 -6.497072342 9.439151025 8.856030535
#> 126 127 128 129 130
#> 5.326244045 -13.534595886 -13.461446344 0.227405390 -1.538154436
#> 131 132 133 134 135
#> -14.341863772 14.689309821 -16.656858140 -9.047979967 12.928314541
#> 136 137 138 139 140
#> -2.709124044 -2.782670867 2.868811635 3.595873371 13.092832072
#> 141 142 143 144 145
#> -9.542161620 -6.268075116 -6.046655043 5.703058849 8.129136259
#> 146 147 148 149 150
#> 5.215619079 -15.124477646 9.213204905 1.050326326 11.192129388
#> 151 152 153 154 155
#> -11.150774527 -15.549109290 4.134728267 15.494483554 -10.774452246
#> 156 157 158 159 160
#> -9.560610172 5.905003717 12.929715319 -2.125934374 4.260249176
#> 161 162 163 164 165
#> 0.600546683 -8.451041938 -5.852634182 12.604127692 4.843858639
#> 166 167 168 169 170
#> -2.067063786 1.799029553 -13.577062244 -10.532228152 12.557209536
#> 171 172 173 174 175
#> -6.284265342 -3.190900312 16.055710569 -11.829483495 -3.257831306
#> 176 177 178 179 180
#> 4.520471063 8.052259330 -3.218297052 12.843077803 8.813152722
#> 181 182 183 184 185
#> 7.892344188 15.128974924 -7.762819554 0.631694902 10.428474577
#> 186 187 188 189 190
#> -9.735353775 11.546709396 1.440102150 12.958767285 14.123005449
#> 191 192 193 194 195
#> -13.662589289 -12.985999838 7.558881794 -0.623340255 -1.367177254
#> 196 197 198 199 200
#> 8.340845915 -5.975732202 6.974107899 -16.818087002 -16.288042854
#> 201 202 203 204 205
#> 1.542168049 4.525482123 -3.286997578 14.872247960 8.563570369
#> 206 207 208 209 210
#> -2.935594731 -15.619461640 6.003811869 -3.723287287 4.461570283
#> 211 212 213 214 215
#> 15.654677549 8.469446913 7.683136938 11.924178726 16.020607205
#> 216 217 218 219 220
#> -11.913350803 2.884912291 -3.444646885 1.796624915 -5.520292722
#> 221 222 223 224 225
#> -3.537182854 9.720964015 7.218232461 4.031344270 -13.278171844
#> 226 227 228 229 230
#> -12.664426121 16.106081583 14.488413421 2.270405981 10.271342808
#> 231 232 233 234 235
#> 2.542292876 -13.658601185 -8.976264486 7.198682434 8.415284602
#> 236 237 238 239 240
#> -14.080289628 -7.406477725 -13.970309253 -11.042285895 11.284828602
#> 241 242 243 244 245
#> 5.561390321 -6.359887161 1.696000881 10.869963854 13.549427730
#> 246 247 248 249 250
#> 10.329380885 -13.938034188 9.771649514 -16.709795712 -9.152619863
#> 251 252 253 254 255
#> -9.752969251 -6.949814297 9.266069367 -10.855967039 -1.536740562
#> 256 257 258 259 260
#> 14.926693857 -7.811419471 14.952358186 -8.309796256 -3.631960992
#> 261 262 263 264 265
#> 15.234759638 9.520060020 -12.687668568 11.866172105 -4.915643527
#> 266 267 268 269 270
#> -1.072522176 5.285994856 -15.635538018 -15.545356703 -5.026225344
#> 271 272 273 274 275
#> -5.262112004 16.268731054 5.188572355 14.803065543 0.467061733
#> 276 277 278 279 280
#> 12.086137348 4.386527564 7.471694672 -15.006752744 12.917132035
#> 281 282 283 284 285
#> -15.711271601 11.623809418 1.798501220 7.983852032 4.376262775
#> 286 287 288 289 290
#> 12.033806527 -15.464637091 13.511224399 2.000107247 14.599591953
#> 291 292 293 294 295
#> 6.760505299 7.258151736 9.830320086 16.178414277 -16.239101678
#> 296 297 298 299 300
#> 8.510304480 8.277741927 14.388249059 -9.577867054 0.910277803
#> 301 302 303 304 305
#> -11.921072322 -16.847098531 -11.755448753 -16.338441263 1.559721312
#> 306 307 308 309 310
#> -12.452072818 -5.381597696 -12.309452405 8.639533393 4.072202907
#> 311 312 313 314 315
#> 14.167780088 -10.599785922 6.531346696 -5.928666246 -12.164053059
#> 316 317 318 319 320
#> -5.637959432 13.168301201 11.988239288 -6.114149553 9.408891051
#> 321 322 323 324 325
#> 5.861061977 -15.806731009 -6.953020061 -8.750388267 12.038067671
#> 326 327 328 329 330
#> -8.489995859 8.563821036 7.314957674 -0.596982489 4.345056768
#> 331 332 333 334 335
#> 1.813870110 7.526737006 11.156873722 -14.862065969 -1.275979810
#> 336 337 338 339 340
#> -4.875506513 10.096509846 -12.559017577 2.399776943 -6.090053679
#> 341 342 343 344 345
#> -12.006309200 5.553245739 13.720766344 -15.794285582 -8.996551612
#> 346 347 348 349 350
#> 13.138790307 8.201665992 -9.730488523 -6.723464798 9.926041259
#> 351 352 353 354 355
#> 8.135463308 -10.209854766 -13.186917604 7.900964972 -0.090115445
#> 356 357 358 359 360
#> 6.670747365 -6.178761883 -5.517026333 -1.039974342 -5.009726012
#> 361 362 363 364 365
#> -14.409833237 9.527045572 2.383265289 -12.516012633 -7.972397852
#> 366 367 368 369 370
#> -7.623633362 -2.724286587 10.802355099 -8.762335088 -14.019856700
#> 371 372 373 374 375
#> -2.716099878 13.115306492 -7.773676176 -15.225851913 -0.785977636
#> 376 377 378 379 380
#> -6.683845438 4.536240039 -8.840516265 10.011312808 -10.858560332
#> 381 382 383 384 385
#> 14.484684632 -10.487621779 8.818907250 0.193071757 11.087729728
#> 386 387 388 389 390
#> -6.027850801 15.862762819 14.107946363 9.606831789 -10.025493392
#> 391 392 393 394 395
#> -11.151453589 -8.559611080 -1.995868440 -4.606958286 13.213490030
#> 396 397 398 399 400
#> 14.632799033 -15.566116109 -9.453145100 -3.271386623 -0.618715518
#> 401 402 403 404 405
#> -15.299059050 -15.044560484 7.226037373 -5.260511466 13.107635973
#> 406 407 408 409 410
#> 12.212088225 -3.894102613 -3.079525275 6.740023629 -11.784183251
#> 411 412 413 414 415
#> -3.907187013 11.754011457 -5.449888581 12.526328017 6.370510737
#> 416 417 418 419 420
#> 7.199450639 -6.735282627 8.458346234 5.438022105 -16.215535130
#> 421 422 423 424 425
#> -11.977797408 5.509695041 -6.732307118 -15.850858305 -4.439764046
#> 426 427 428 429 430
#> 9.927881180 14.051780399 -9.206567961 -2.950680422 -10.097271334
#> 431 432 433 434 435
#> -8.227481385 -16.613109820 14.627726581 -8.655920622 6.876032459
#> 436 437 438 439 440
#> 9.225249796 7.449826685 4.888284804 2.522208021 7.234200639
#> 441 442 443 444 445
#> 4.637155207 0.324023046 10.918504037 7.809565249 10.315734565
#> 446 447 448 449 450
#> 8.708019179 -1.836917139 -0.742406906 -8.348653897 -3.956271966
#> 451 452 453 454 455
#> 13.824902752 -1.483810236 7.603752287 8.128311993 9.971395153
#> 456 457 458 459 460
#> 15.712488828 -12.072063433 -9.668787591 -13.248556950 -8.613945330
#> 461 462 463 464 465
#> -5.009708203 7.452788656 -12.604892574 3.099922217 11.916835943
#> 466 467 468 469 470
#> 4.525708216 -10.699586760 12.748155926 8.332584655 -0.265595317
#> 471 472 473 474 475
#> -15.594373692 -13.061435621 -8.809086598 -1.377227744 2.503097742
#> 476 477 478 479 480
#> -3.218599207 9.508981924 -4.397986236 1.106364307 -4.327626515
#> 481 482 483 484 485
#> 4.644371804 -14.066319322 -7.316344768 -14.247757233 6.989367737
#> 486 487 488 489 490
#> -9.957923099 -16.965985725 14.744807534 2.506397624 -14.412846184
#> 491 492 493 494 495
#> -2.370505225 2.940267289 -12.695859353 6.469933544 8.897063978
#> 496 497 498 499 500
#> -11.511258815 -2.551303876 -1.524126396 -3.169418260 6.140852877
#> 501 502 503 504 505
#> -5.786842301 9.819382946 -11.074145631 2.709995045 -1.988477478
#> 506 507 508 509 510
#> 6.310556824 -13.983968477 6.210650701 2.416212326 -1.609771118
#> 511 512 513 514 515
#> 0.641945858 13.283322866 15.711630689 11.212290754 -6.153409109
#> 516 517 518 519 520
#> -10.824774384 -4.963028113 11.544517970 -12.422443231 -3.755436206
#> 521 522 523 524 525
#> 6.469815363 -1.011372980 12.284201691 1.227211865 -2.539674871
#> 526 527 528 529 530
#> 4.887667436 4.175912129 10.714325718 -3.909351090 6.934134106
#> 531 532 533 534 535
#> 10.709115580 -0.984695321 -2.824503885 4.202181263 -4.999381325
#> 536 537 538 539 540
#> -4.811899672 -8.580489272 -1.536123729 -1.759922410 -11.395092759
#> 541 542 543 544 545
#> 6.311897279 15.943099603 11.621432755 -5.454714613 6.678095154
#> 546 547 548 549 550
#> -9.096548033 -3.597373407 4.349108705 9.629899709 11.929364771
#> 551 552 553 554 555
#> 4.753000750 15.116911209 11.800416531 -14.780611925 8.849994147
#> 556 557 558 559 560
#> -2.414033217 -13.177824833 -0.444706867 7.938837885 -10.938831873
#> 561 562 563 564 565
#> -2.913660361 8.712060639 -1.730758540 -8.876593407 -11.942056721
#> 566 567 568 569 570
#> -15.472103324 4.313755162 7.609209426 6.491078095 -1.557671164
#> 571 572 573 574 575
#> -2.014470038 -0.999477353 -8.516778417 -9.925084455 13.436323645
#> 576 577 578 579 580
#> 10.126339727 8.628724942 11.530019859 -1.688738727 5.165548701
#> 581 582 583 584 585
#> 2.936534486 -12.074738732 -14.480563060 12.038496655 -15.894626998
#> 586 587 588 589 590
#> -7.358149198 11.406167172 2.499444047 9.119483774 10.754726953
#> 591 592 593 594 595
#> 8.430681956 -2.691320618 -13.838742813 -15.848750249 -0.592733156
#> 596 597 598 599 600
#> 10.166099028 6.136141113 -0.236640367 15.724590911 -12.806345811
#> 601 602 603 604 605
#> -11.056608898 8.096145623 -6.093967542 -11.964468912 -4.099536242
#> 606 607 608 609 610
#> -1.755942296 -6.524863937 -7.355962368 5.629115621 -14.734920987
#> 611 612 613 614 615
#> -9.388657957 -15.486025365 -7.993308793 1.592336467 1.623661531
#> 616 617 618 619 620
#> 10.812112944 11.641603281 -0.327509788 -4.649775877 10.800990938
#> 621 622 623 624 625
#> 12.213348952 -11.158622433 -6.451580529 0.457328462 -1.777336576
#> 626 627 628 629 630
#> -8.292074348 -14.269065160 -3.149506561 -11.663917180 -13.851880189
#> 631 632 633 634 635
#> -1.963227797 13.629949558 6.276893310 -16.584754105 14.091292009
#> 636 637 638 639 640
#> 3.118223025 9.274882395 15.340436734 -7.096808695 10.414343158
#> 641 642 643 644 645
#> -9.099927937 13.557476381 6.213758936 -3.966183647 0.829334012
#> 646 647 648 649 650
#> 6.335424685 -15.781194742 -5.748737358 -14.942087982 2.709912489
#> 651 652 653 654 655
#> 13.459690805 15.076844491 14.776366479 -4.583519365 -15.015124195
#> 656 657 658 659 660
#> -10.033766625 8.467333851 10.134078838 -3.947376003 -0.969585204
#> 661 662 663 664 665
#> 0.299736379 11.920187592 2.268800158 1.694012548 14.562812926
#> 666 667 668 669 670
#> 4.210562672 -13.611332578 4.370825979 -7.601485631 -16.410812309
#> 671 672 673 674 675
#> -6.894964455 5.702533623 6.904344320 13.743834527 0.574088095
#> 676 677 678 679 680
#> 6.644418831 -15.324238691 13.224195707 -8.103765857 14.491276042
#> 681 682 683 684 685
#> 2.210548170 -5.182638163 15.013707955 11.122525792 16.078260470
#> 686 687 688 689 690
#> -12.797201281 13.409096899 -6.180910615 -4.610862881 -5.245329658
#> 691 692 693 694 695
#> 10.670966627 -2.923886790 14.304880466 -12.399132882 -12.976517164
#> 696 697 698 699 700
#> 6.504068927 -4.619996933 5.154179555 -9.417948036 9.023377867
#> 701 702 703 704 705
#> -1.969582900 -8.509885015 7.171045380 11.860274791 -9.912255402
#> 706 707 708 709 710
#> -7.042674066 -14.014841355 7.344967012 13.549913139 13.171901293
#> 711 712 713 714 715
#> -3.225014919 8.257655786 1.926952582 -4.458817614 1.001780687
#> 716 717 718 719 720
#> 10.001172810 11.003791295 -3.211744956 10.549185829 -11.574834022
#> 721 722 723 724 725
#> 1.158730481 -2.625344151 15.293497600 0.884586413 -0.004806659
#> 726 727 728 729 730
#> 7.955980306 -11.943529143 3.051212784 -11.875627076 -4.254218905
#> 731 732 733 734 735
#> 15.013677018 -3.995308041 14.514619512 -3.708612772 3.604515528
#> 736 737 738 739 740
#> 8.643510221 7.140413940 -9.404551972 -15.445101330 13.712831224
#> 741 742 743 744 745
#> 4.259874625 -5.178199454 -11.450197337 6.353518417 -4.161826574
#> 746 747 748 749 750
#> -14.027597678 -12.827530660 -5.205141420 13.425197261 3.592453921
#> 751 752 753 754 755
#> 8.045959869 5.769555682 6.307167962 2.479192236 8.861237131
#> 756 757 758 759 760
#> -16.341082666 -5.069538782 11.547915473 6.501201757 -3.150694668
#> 761 762 763 764 765
#> 15.470805265 -4.213639748 13.305870241 -15.685813356 -12.446135547
#> 766 767 768 769 770
#> -6.316108092 -8.746978745 -9.096462152 8.872905968 -0.768245800
#> 771 772 773 774 775
#> -11.001294694 12.976651322 -6.459962635 -0.911973283 -0.719497619
#> 776 777 778 779 780
#> 14.703786227 12.353474855 15.570724609 -0.257659476 9.440918627
#> 781 782 783 784 785
#> -3.297216072 -5.818363708 -1.694269564 -15.382063717 1.712036651
#> 786 787 788 789 790
#> 15.820384496 -13.764337518 3.169940275 -1.391105497 -15.131553697
#> 791 792 793 794 795
#> -8.785693151 -0.739134721 -14.790496970 -5.813275772 -8.459372943
#> 796 797 798 799 800
#> -7.210091818 9.173184421 9.950080646 -14.975455711 3.777063203
#> 801 802 803 804 805
#> -3.837357114 -10.069700276 -4.534569936 7.355914683 -2.635749788
#> 806 807 808 809 810
#> 2.606401213 -14.496478510 -6.933811138 0.334778413 -2.004366440
#> 811 812 813 814 815
#> -5.611478758 6.850967768 -2.431931118 11.643567001 -4.082342814
#> 816 817 818 819 820
#> 11.627696452 1.992184837 14.186486360 12.311402631 -0.775262785
#> 821 822 823 824 825
#> 3.262359086 3.672363736 2.099518344 13.074883744 15.492402118
#> 826 827 828 829 830
#> -8.271531936 -10.976553639 1.252128672 -10.210052000 10.957278184
#> 831 832 833 834 835
#> -11.395838947 0.119636497 3.062962092 6.617090310 -16.865795658
#> 836 837 838 839 840
#> -0.790872422 -8.640472881 -4.538901794 2.743533760 9.846048268
#> 841 842 843 844 845
#> -16.503006368 -12.782455967 -11.173596809 15.038001070 -0.758989375
#> 846 847 848 849 850
#> -0.139613062 -3.713890208 4.224416447 11.010089648 -2.559850574
#> 851 852 853 854 855
#> 7.965154431 -1.766763123 16.054201670 2.875317714 15.576669590
#> 856 857 858 859 860
#> -7.516103263 15.698922646 13.332189515 -3.790349497 -8.546957051
#> 861 862 863 864 865
#> 9.287749645 -8.062736374 11.117702007 15.060480249 -4.040014522
#> 866 867 868 869 870
#> -2.364211258 -13.496949174 -1.409173144 15.887069837 3.861702452
#> 871 872 873 874 875
#> -2.807126196 12.657292976 -6.746107585 -0.831844737 12.133613549
#> 876 877 878 879 880
#> -11.360887916 0.193690915 6.001994677 0.658401599 -5.339095527
#> 881 882 883 884 885
#> -10.405619749 -4.912386059 14.384983616 2.002479957 -4.335026141
#> 886 887 888 889 890
#> 9.381696202 -2.559388174 -8.770346920 -13.717712590 -8.699116732
#> 891 892 893 894 895
#> 4.179329045 13.041461025 -6.222840798 11.503957227 0.707004693
#> 896 897 898 899 900
#> 1.143887127 -13.105928424 6.289986018 -7.926619871 -7.993050159
#> 901 902 903 904 905
#> -6.564995279 -1.251128487 -8.000041864 -8.610468030 10.580402027
#> 906 907 908 909 910
#> -0.254551907 6.346167978 14.693799259 6.306636126 -14.697694425
#> 911 912 913 914 915
#> 9.155528344 -7.057040489 -2.509099088 -12.050597004 10.064890547
#> 916 917 918 919 920
#> -2.361060772 7.142789115 -16.250486060 -0.976891789 1.524894708
#> 921 922 923 924 925
#> -5.115918848 15.945267004 -0.944649356 -11.812308557 -13.403232910
#> 926 927 928 929 930
#> -1.819254344 4.138961629 -7.865874528 14.398866228 0.775533389
#> 931 932 933 934 935
#> 13.593088177 13.505949723 -6.454519833 9.856658113 -11.168294614
#> 936 937 938 939 940
#> 5.590747860 -12.539742605 -7.534725026 -8.945551443 2.039057247
#> 941 942 943 944 945
#> -16.425655741 -6.601243569 -0.625018815 13.293941577 13.080696309
#> 946 947 948 949 950
#> -2.519774425 10.856512574 -2.017861807 15.091233776 1.868543488
#> 951 952 953 954 955
#> -13.911077576 1.996510782 11.174865982 -1.171689519 5.367527148
#> 956 957 958 959 960
#> -2.059673336 -3.285574242 -6.413147951 2.317252849 -10.817431012
#> 961 962 963 964 965
#> 12.966753009 -3.976600955 -16.149837104 9.603892106 5.610745943
#> 966 967 968 969 970
#> -13.235149223 14.579006919 -9.887442308 -15.470067293 10.622281551
#> 971 972 973 974 975
#> 15.593124928 5.438010310 12.937445974 -10.173015356 -0.806981045
#> 976 977 978 979 980
#> -0.095144522 10.107963416 -1.143930255 -14.514165507 -10.617329537
#> 981 982 983 984 985
#> 7.829847268 8.608473240 -14.914078880 -6.475567538 12.568898831
#> 986 987 988 989 990
#> -15.027619281 3.938740539 16.220842732 7.561807311 -16.766896395
#> 991 992 993 994 995
#> 6.184391145 1.524398202 -12.100097279 6.776853321 1.195185863
#> 996 997 998 999 1000
#> -10.583294339 -16.480924129 -12.806868324 10.726699546 3.698219440
#--------------------------------------------------------------------------------
# Example 2: Predictions using new values for covariates
predict(norm_mod, newdata = data.frame(x=0:6))
#> 1 2 3 4 5 6 7
#> -1.852745 1.173079 4.198903 7.224726 10.250550 13.276373 16.302197
#--------------------------------------------------------------------------------
# Example 3: Predictions for another parameter
predict(norm_mod, newdata = data.frame(x=0:6), param = "sd",
type = "response")
#> 1 2 3 4 5 6 7
#> 2.712390 3.676221 4.982544 6.753060 9.152719 12.405082 16.813152
#--------------------------------------------------------------------------------
# Example 4: Model terms
predict(norm_mod, param = "sd", type = "terms")
#> 1 2 3 4 5 6
#> 0.643536324 0.514245402 -1.561962332 0.334743374 0.778660051 0.646294939
#> 7 8 9 10 11 12
#> 0.412659845 -0.445176240 1.022802830 0.852840505 -1.482817999 -1.251082649
#> 13 14 15 16 17 18
#> -1.022339263 -1.189765464 -0.485026597 1.478081582 -0.527982636 -0.877474267
#> 19 20 21 22 23 24
#> -1.332211485 -0.692356359 1.299209752 -1.033111951 -0.061790806 -0.816569939
#> 25 26 27 28 29 30
#> 1.327961488 0.536720717 -0.265776418 0.353721478 0.040869549 0.219204864
#> 31 32 33 34 35 36
#> 0.532906853 -0.447729270 1.442189782 -0.255123113 -1.541491220 1.391588522
#> 37 38 39 40 41 42
#> 1.343834176 0.972819665 -0.845349424 0.181549817 1.592768384 -0.479750364
#> 43 44 45 46 47 48
#> -0.071267791 -1.502552841 -1.424647895 -0.951118565 -1.363419184 -0.331223343
#> 49 50 51 52 53 54
#> 0.815242490 1.221264267 -1.169635910 -0.145033665 -1.136607103 -0.663194275
#> 55 56 57 58 59 60
#> -0.817832685 1.214793281 -0.429222819 -1.628272093 0.288742122 1.453686112
#> 61 62 63 64 65 66
#> -0.645248972 -0.833616458 0.385105289 -1.618072846 -0.324639318 -1.702120445
#> 67 68 69 70 71 72
#> -0.778949042 1.138738073 -0.264948701 1.344455478 -1.302799913 1.525898447
#> 73 74 75 76 77 78
#> -1.100308889 1.277838572 0.691208725 0.823804118 1.183180384 0.190787344
#> 79 80 81 82 83 84
#> 1.540098914 0.640299582 0.240074454 1.332759729 -1.065418085 0.523123727
#> 85 86 87 88 89 90
#> -0.809429759 -0.334721416 -0.565680914 -1.342054002 0.708919119 1.540440814
#> 91 92 93 94 95 96
#> -0.942327824 -1.358074527 1.324505633 0.254235652 -0.536702243 -0.110931689
#> 97 98 99 100 101 102
#> -1.214921447 1.307526522 0.219467016 1.231316616 -0.348098821 0.762129620
#> 103 104 105 106 107 108
#> -1.301005835 1.274655850 0.064196799 -0.030771647 0.154787450 0.498394411
#> 109 110 111 112 113 114
#> -1.401530731 0.717979561 0.955825180 1.308921922 0.140698593 1.249641862
#> 115 116 117 118 119 120
#> -0.315953650 -0.932141476 1.129354416 -0.759779644 -1.182211055 1.416617997
#> 121 122 123 124 125 126
#> 0.342795745 1.126792049 -0.669009337 0.932370165 0.873774275 0.519077456
#> 127 128 129 130 131 132
#> -1.376187297 -1.368836737 0.006711664 -0.170703728 -1.457307034 1.459941628
#> 133 134 135 136 137 138
#> -1.689933325 -0.925341787 1.282984913 -0.288370673 -0.295761156 0.272138028
#> 139 140 141 142 143 144
#> 0.345198108 1.299516747 -0.975000501 -0.645998147 -0.623748360 0.556942356
#> 145 146 147 148 149 150
#> 0.800731022 0.507961111 -1.535949369 0.909665571 0.089404325 1.108521287
#> 151 152 153 154 155 156
#> -1.136644805 -1.578619229 0.399345892 1.540850930 -1.098829397 -0.976854337
#> 157 158 159 160 161 162
#> 0.577235142 1.283125672 -0.229767831 0.411959082 0.044207425 -0.865357416
#> 163 164 165 166 167 168
#> -0.604251832 1.250408426 0.470604108 -0.223852116 0.164639089 -1.380454604
#> 169 170 171 172 173 174
#> -1.074489082 1.245693772 -0.647625050 -0.336782811 1.597246816 -1.204846073
#> 175 176 177 178 179 180
#> -0.343508490 0.438107937 0.793005908 -0.339535821 1.274419749 0.869465622
#> 181 182 183 184 185 186
#> 0.776936553 1.504122151 -0.796200177 0.047337409 1.031784086 -0.994413756
#> 187 188 189 190 191 192
#> 1.144151884 0.128571636 1.286045010 1.403035535 -1.389048940 -1.321060656
#> 193 194 195 196 197 198
#> 0.743427996 -0.078777012 -0.153522784 0.822005040 -0.616621553 0.684665961
#> 199 200 201 202 203 204
#> -1.706134691 -1.652872271 0.138827908 0.438611482 -0.346439314 1.478324490
#> 205 206 207 208 209 210
#> 0.844385899 -0.311127980 -1.585688709 0.587164053 -0.390280655 0.432189188
#> 211 212 213 214 215 216
#> 1.556948306 0.834927738 0.755913994 1.182082555 1.593719393 -1.213273627
#> 217 218 219 220 221 222
#> 0.273755930 -0.362280983 0.164397455 -0.570855914 -0.371579623 0.960688640
#> 223 224 225 226 227 228
#> 0.709197248 0.388957169 -1.350420075 -1.288746754 1.602308437 1.439754199
#> 229 230 231 232 233 234
#> 0.212006180 1.015994424 0.239327214 -1.388648188 -0.918135330 0.707232729
#> 235 236 237 238 239 240
#> 0.829485143 -1.431022295 -0.760392540 -1.419970723 -1.125743134 1.117836330
#> 241 242 243 244 245 246
#> 0.542706544 -0.655224042 0.154286071 1.076147915 1.345398567 1.021826482
#> 247 248 249 250 251 252
#> -1.416727506 0.965781862 -1.695252850 -0.935856711 -0.996183878 -0.714503910
#> 253 254 255 256 257 258
#> 0.914977750 -1.107020555 -0.170561652 1.483795582 -0.801083825 1.486374507
#> 259 260 261 262 263 264
#> -0.851164095 -0.381103571 1.514752115 0.940500448 -1.291082313 1.176253657
#> 265 266 267 268 269 270
#> -0.510096674 -0.123913849 0.515032945 -1.587304172 -1.578242143 -0.521208683
#> 271 272 273 274 275 276
#> -0.544912170 1.618652555 0.505243273 1.471372572 0.030793954 1.198357253
#> 277 278 279 280 281 282
#> 0.424648389 0.734666845 -1.524119575 1.281861219 -1.594914394 1.151899415
#> 283 284 285 286 287 288
#> 0.164585999 0.786131880 0.423616913 1.193098698 -1.570130891 1.341559637
#> 289 290 291 292 293 294
#> 0.184844736 1.450926170 0.663201727 0.713208606 0.971677478 1.609576915
#> 295 296 297 298 299 300
#> -1.647954330 0.839033382 0.815663924 1.429689007 -0.978588425 0.075331302
#> 301 302 303 304 305 306
#> -1.214049537 -1.709049966 -1.197406561 -1.657936644 0.140591779 -1.267408058
#> 307 308 309 310 311 312
#> -0.556918900 -1.253076595 0.852019178 0.393062921 1.407534793 -1.081277744
#> 313 314 315 316 317 318
#> 0.640174321 -0.611892048 -1.238465885 -0.582679861 1.307100395 1.188519793
#> 319 320 321 322 323 324
#> -0.630530665 0.929329438 0.572819579 -1.604506801 -0.714826047 -0.895437760
#> 325 326 327 328 329 330
#> 1.193526886 -0.869271770 0.844411088 0.718916851 -0.076128405 0.420481122
#> 331 332 333 334 335 336
#> 0.166130369 0.740197871 1.104978559 -1.509580469 -0.144358648 -0.506063435
#> 337 338 339 340 341 342
#> 0.998426025 -1.278154591 0.225006250 -0.628109349 -1.222614715 0.541888121
#> 343 344 345 346 347 348
#> 1.362615829 -1.603256201 -0.920173918 1.304134941 0.808019300 -0.993924862
#> 349 350 351 352 353 354
#> -0.691758782 0.981296189 0.801366806 -1.042094824 -1.341250232 0.777802828
#> 355 356 357 358 359 360
#> -0.025194977 0.654182243 -0.637023349 -0.570527685 -0.120643223 -0.519550718
#> 361 362 363 364 365 366
#> -1.464137066 0.941202404 0.223347047 -1.273833163 -0.817260021 -0.782213807
#> 367 368 369 370 371 372
#> -0.289894308 1.069354130 -0.896638257 -1.424949586 -0.289071652 1.301775129
#> 373 374 375 376 377 378
#> -0.797291123 -1.546136141 -0.095119916 -0.687777560 0.439692511 -0.904494431
#> 379 380 381 382 383 384
#> 0.989864851 -1.107281147 1.439379505 -1.070006732 0.870043876 0.003261589
#> 385 386 387 388 389 390
#> 1.098030503 -0.621858783 1.577858121 1.401522296 0.949219862 -1.023568947
#> 391 392 393 394 395 396
#> -1.136713042 -0.876267178 -0.216697926 -0.479077893 1.311641274 1.454263042
#> 397 398 399 400 401 402
#> -1.580328189 -0.966055519 -0.344870620 -0.078312287 -1.553492489 -1.527918752
#> 403 404 405 406 407 408
#> 0.709981538 -0.544751337 1.301004343 1.211013649 -0.407445334 -0.325591094
#> 409 410 411 412 413 414
#> 0.661143590 -1.200293998 -0.408760143 1.164982997 -0.563781230 1.242590588
#> 415 416 417 418 419 420
#> 0.624012436 0.707309923 -0.692946317 0.833812267 0.530309671 -1.645586204
#> 421 422 423 424 425 426
#> -1.219749658 0.537511853 -0.692647318 -1.608941010 -0.462277085 0.981481076
#> 427 428 429 430 431 432
#> 1.395878360 -0.941277781 -0.312643892 -1.030781680 -0.842892540 -1.685537198
#> 433 434 435 436 437 438
#> 1.453753328 -0.885945012 0.674810677 0.910875923 0.732469402 0.475068349
#> 439 440 441 442 443 444
#> 0.237308952 0.710801838 0.449833149 0.016420460 1.081025561 0.768618365
#> 445 446 447 448 449 450
#> 1.020455208 0.858901093 -0.200725425 -0.090741634 -0.855068774 -0.413692531
#> 451 452 453 454 455 456
#> 1.373080160 -0.165242855 0.747936887 0.800648194 0.985853655 1.562757575
#> 457 458 459 460 461 462
#> -1.229222145 -0.987724735 -1.347444171 -0.881727051 -0.519548929 0.732767040
#> 463 464 465 466 467 468
#> -1.282764421 0.295361582 1.181344703 0.438634202 -1.091306407 1.264881357
#> 469 470 471 472 473 474
#> 0.821174893 -0.042828381 -1.583167702 -1.328640954 -0.901336165 -0.154532725
#> 475 476 477 478 479 480
#> 0.235388622 -0.339566183 0.939387246 -0.458078968 0.095035401 -0.451008748
#> 481 482 483 484 485 486
#> 0.450558322 -1.429618464 -0.751335371 -1.447850573 0.686199372 -1.016779027
#> 487 488 489 490 491 492
#> -1.720996555 1.465518414 0.235720217 -1.464439827 -0.254343964 0.279318375
#> 493 494 495 496 497 498
#> -1.291905378 0.634003112 0.877897592 -1.172868705 -0.272511835 -0.169294096
#> 499 500 501 502 503 504
#> -0.334624149 0.600934861 -0.597640619 0.970578440 -1.128944616 0.256179063
#> 505 506 507 508 509 510
#> -0.215955233 0.617987861 -1.421343294 0.607948618 0.226657788 -0.177900256
#> 511 512 513 514 515 516
#> 0.048367494 1.318658550 1.562671343 1.110547237 -0.634475731 -1.103886106
#> 517 518 519 520 521 522
#> -0.514858198 1.143931675 -1.264430677 -0.393511196 0.633991236 -0.117769165
#> 523 524 525 526 527 528
#> 1.218260097 0.107178981 -0.271343275 0.475006312 0.403484325 1.060508342
#> 529 530 531 532 533 534
#> -0.408977604 0.680649124 1.059984792 -0.115088413 -0.299964820 0.406124026
#> 535 536 537 538 539 540
#> -0.518511214 -0.499671790 -0.878365160 -0.170499669 -0.192988474 -1.161195554
#> 541 542 543 544 545 546
#> 0.618122559 1.585930905 1.151660592 -0.564266182 0.654920598 -0.930222234
#> 547 548 549 550 551 552
#> -0.377627977 0.420888289 0.951537883 1.182603684 0.461474093 1.502909907
#> 553 554 555 556 557 558
#> 1.169646093 -1.501395416 0.873167698 -0.258717951 -1.340336529 -0.060826721
#> 559 560 561 562 563 564
#> 0.781608554 -1.115347374 -0.308923866 0.859307206 -0.190057891 -0.908119706
#> 565 566 567 568 569 570
#> -1.216158192 -1.570881148 0.417335725 0.748485257 0.636127859 -0.172664901
#> 571 572 573 574 575 576
#> -0.218567141 -0.116573811 -0.871963062 -1.013479177 1.334033103 1.001423533
#> 577 578 579 580 581 582
#> 0.850933071 1.142474806 -0.185835456 0.502929701 0.278943278 -1.229490978
#> 583 584 585 586 587 588
#> -1.471244477 1.193569994 -1.613339185 -0.755536162 1.130029251 0.235021474
#> 589 590 591 592 593 594
#> 0.900247838 1.064568132 0.831032373 -0.286581665 -1.406750038 -1.608729179
#> 595 596 597 598 599 600
#> -0.075701404 1.005418817 0.600461391 -0.039918792 1.563973674 -1.303007805
#> 601 602 603 604 605 606
#> -1.127182406 0.797415899 -0.628502640 -1.218410320 -0.428088695 -0.192588525
#> 607 608 609 610 611 612
#> -0.671802024 -0.755316415 0.549512040 -1.496804081 -0.959575415 -1.572280129
#> 613 614 615 616 617 618
#> -0.819361294 0.143869170 0.147016924 1.070334664 1.153687463 -0.049049966
#> 619 620 621 622 623 624
#> -0.483380494 1.069217050 1.211140335 -1.137433416 -0.664438011 0.029815889
#> 625 626 627 628 629 630
#> -0.194738367 -0.849383278 -1.449991737 -0.332623287 -1.188208849 -1.408070170
#> 631 632 633 634 635 636
#> -0.213417974 1.353489944 0.614605123 -1.682687824 1.399848754 0.297200571
#> 637 638 639 640 641 642
#> 0.915863342 1.525371264 -0.729274901 1.030364066 -0.930561870 1.346207349
#> 643 644 645 646 647 648
#> 0.608260955 -0.414688524 0.067197523 0.620486752 -1.601940744 -0.593811576
#> 649 650 651 652 653 654
#> -1.517621622 0.256170767 1.336381193 1.498883733 1.468689670 -0.476722592
#> 655 656 657 658 659 660
#> -1.524960795 -1.024400297 0.834715403 1.002201212 -0.412798605 -0.113570046
#> 661 662 663 664 665 666
#> 0.013979971 1.181681499 0.211844816 0.154086270 1.447230365 0.406966246
#> 667 668 669 670 671 672
#> -1.383898319 0.423070587 -0.779988253 -1.665208976 -0.708992227 0.556889578
#> 673 674 675 676 677 678
#> 0.677655644 1.364933876 0.041548687 0.651536573 -1.556022710 1.312717053
#> 679 680 681 682 683 684
#> -0.830460767 1.440041855 0.205991263 -0.536926101 1.492539347 1.101527046
#> 685 686 687 688 689 690
#> 1.599512783 -1.302088901 1.331297176 -0.637239268 -0.479470253 -0.543225766
#> 691 692 693 694 695 696
#> 1.056151328 -0.309951487 1.421311567 -1.262088296 -1.320107773 0.637433266
#> 697 698 699 700 701 702
#> -0.480388105 0.501787252 -0.962518680 0.890590466 -0.214056578 -0.871270367
#> 703 704 705 706 707 708
#> 0.704455571 1.175661055 -1.012190027 -0.723835088 -1.424445610 0.721932392
#> 709 710 711 712 713 714
#> 1.345447344 1.307462157 -0.340210877 0.813645533 0.177493660 -0.464191717
#> 715 716 717 718 719 720
#> 0.084526131 0.988845915 1.089595801 -0.338877422 1.043913969 -1.179257171
#> 721 722 723 724 725 726
#> 0.100297508 -0.279951903 1.520654502 0.072749658 -0.016622573 0.783331141
#> 727 728 729 730 731 732
#> -1.216306151 0.290466929 -1.209482892 -0.443632255 1.492536238 -0.417615140
#> 733 734 735 736 737 738
#> 1.442387564 -0.388806060 0.346066530 0.852418796 0.701377516 -0.961172553
#> 739 740 741 742 743 744
#> -1.568167805 1.361818455 0.411921445 -0.536480069 -1.166732834 0.622304932
#> 745 746 747 748 749 750
#> -0.434348048 -1.425727452 -1.305136602 -0.539187380 1.332915049 0.344854499
#> 751 752 753 754 755 756
#> 0.792372896 0.563624407 0.617647325 0.232986435 0.874297469 -1.658202070
#> 757 758 759 760 761 762
#> -0.525561110 1.144273079 0.637145153 -0.332742676 1.538471576 -0.439554586
#> 763 764 765 766 767 768
#> 1.320924263 -1.592356178 -1.266811441 -0.650824825 -0.895095148 -0.930213604
#> 769 770 771 772 773 774
#> 0.875470032 -0.093338101 -1.121624061 1.287842119 -0.665280302 -0.107780811
#> 775 776 777 778 779 780
#> -0.088439554 1.461396315 1.225221133 1.548512147 -0.042030934 0.932547786
#> 781 782 783 784 785 786
#> -0.347466138 -0.600808103 -0.186391232 -1.561833360 0.155897454 1.573599661
#> 787 788 789 790 791 792
#> -1.399273290 0.302397470 -0.155927256 -1.536660419 -0.898985433 -0.090412823
#> 793 794 795 796 797 798
#> -1.502388732 -0.600296833 -0.866194572 -0.740658356 0.905644042 0.983711829
#> 799 800 801 802 803 804
#> -1.520974637 0.363405288 -0.401743163 -1.028011153 -0.471803822 0.723032488
#> 805 806 807 808 809 810
#> -0.280997532 0.245769254 -1.472843769 -0.712895804 0.017501232 -0.217551863
#> 811 812 813 814 815 816
#> -0.580018904 0.672292007 -0.260516453 1.153884791 -0.426360983 1.152290011
#> 817 818 819 820 821 822
#> 0.184048638 1.409414526 1.220993432 -0.094043215 0.311684337 0.352884377
#> 823 824 825 826 827 828
#> 0.194834235 1.297713177 1.540641774 -0.847319037 -1.119137912 0.109682790
#> 829 830 831 832 833 834
#> -1.042114644 1.084921849 -1.161270536 -0.004117683 0.291647579 0.648790419
#> 835 836 837 838 839 840
#> -1.710928780 -0.095611777 -0.884392719 -0.472239117 0.259549259 0.973257952
#> 841 842 843 844 845 846
#> -1.674473258 -1.300607192 -1.138938143 1.494980483 -0.092407953 -0.030168832
#> 847 848 849 850 851 852
#> -0.389336373 0.408358367 1.090228702 -0.273370666 0.784253019 -0.193675875
#> 853 854 855 856 857 858
#> 1.597095192 0.272791802 1.549109539 -0.771408455 1.561394353 1.323569001
#> 859 860 861 862 863 864
#> -0.397019519 -0.874995616 0.917156331 -0.826337847 1.101042320 1.497239343
#> 865 866 867 868 869 870
#> -0.422107550 -0.253711504 -1.372404301 -0.157742815 1.580300655 0.371910412
#> 871 872 873 874 875 876
#> -0.298218592 1.255750833 -0.694034082 -0.099728952 1.203127982 -1.157758420
#> 877 878 879 880 881 882
#> 0.003323806 0.586981450 0.050021078 -0.552647995 -1.061766614 -0.509769341
#> 883 884 885 886 887 888
#> 1.429360873 0.185083162 -0.451752312 0.926596716 -0.273324200 -0.897443340
#> 889 890 891 892 893 894
#> -1.394588102 -0.890285649 0.403827680 1.294354637 -0.641452696 1.139855857
#> 895 896 897 898 899 900
#> 0.054905046 0.098805947 -1.333111892 0.615920767 -0.812659940 -0.819335305
#> 901 902 903 904 905 906
#> -0.675834693 -0.141861419 -0.820037879 -0.881377628 1.047050784 -0.041718665
#> 907 908 909 910 911 912
#> 0.621566310 1.460392757 0.617593883 -1.493063305 0.903869840 -0.725278723
#> 913 914 915 916 917 918
#> -0.268270813 -1.227065053 0.995248704 -0.253394922 0.701616190 -1.649098310
#> 919 920 921 922 923 924
#> -0.114304261 0.137092166 -0.530221693 1.586148700 -0.111064323 -1.203120219
#> 925 926 927 928 929 930
#> -1.362987057 -0.198950548 0.399771289 -0.806555837 1.430755892 0.061791272
#> 931 932 933 934 935 936
#> 1.349785864 1.341029602 -0.664733373 0.974324101 -1.138405342 0.545656588
#> 937 938 939 940 941 942
#> -1.276217711 -0.773279696 -0.915049076 0.188758695 -1.666700544 -0.679477166
#> 943 944 945 946 947 948
#> -0.078945685 1.319725590 1.298297263 -0.269343543 1.074796239 -0.218907969
#> 949 950 951 952 953 954
#> 1.500329665 0.171624319 -1.414018724 0.184483338 1.106786543 -0.133878855
#> 955 956 957 958 959 960
#> 0.523225861 -0.223109474 -0.346296288 -0.660576046 0.216713671 -1.103148195
#> 961 962 963 964 965 966
#> 1.286847470 -0.415735325 -1.638984422 0.948924463 0.547666131 -1.346096872
#> 967 968 969 970 971 972
#> 1.448857647 -1.009696640 -1.570676554 1.051259122 1.550763083 0.530308486
#> 973 974 975 976 977 978
#> 1.283902501 -1.038392951 -0.097230481 -0.025700333 0.999576957 -0.131089416
#> 979 980 981 982 983 984
#> -1.474621078 -1.083040645 0.770656440 0.848898043 -1.514807078 -0.666848388
#> 985 986 987 988 989 990
#> 1.246868391 -1.526216386 0.379651720 1.613840413 0.743721972 -1.700990713
#> 991 992 993 994 995 996
#> 0.605309880 0.137042273 -1.232039176 0.664844487 0.103960791 -1.079620558
#> 997 998 999 1000
#> -1.672254285 -1.303060310 1.061751748 0.355482533
#--------------------------------------------------------------------------------