predict.sail.Rd
Similar to other predict methods, this functions predicts fitted
values, logits, coefficients and more from a fitted sail
object.
# S3 method for sail predict(object, newx, newe, s = NULL, type = c("link", "response", "coefficients", "nonzero", "class"), ...) # S3 method for sail coef(object, s = NULL, ...)
object | Fitted |
---|---|
newx | matrix of new values for |
newe | vector of new values for the exposure variable |
s | Value(s) of the penalty parameter |
type | Type of prediction required. Type |
... | currently ignored |
The object returned depends on type.
R Source code file for predict, coef, plot and print methods for the sail package Author: Sahir Bhatnagar Created: 2016 Updated: April 6, 2018
s
is the new vector at which predictions are requested. If
s
is not in the lambda sequence used for fitting the model, the
predict function will use linear interpolation to make predictions. The new
values are interpolated using a fraction of predicted values from both left
and right lambda indices. coef(...)
is equivalent to
predict(sail.object, type="coefficients",...)
f.basis <- function(i) splines::bs(i, degree = 3) fit <- sail(x = sailsim$x, y = sailsim$y, e = sailsim$e, basis = f.basis, dfmax = 5, nlambda = 50) predict(fit) # predicted response for whole solution path#> s1 s2 s3 s4 s5 s6 s7 s8 #> [1,] 5.218785 5.184726 5.153713 5.125481 5.152409 5.323012 5.471821 5.655753 #> [2,] 5.218785 5.196073 5.175393 5.156568 5.050692 5.088265 5.183581 5.271707 #> [3,] 5.218785 5.269678 5.316019 5.358204 5.314529 4.890158 4.484710 4.104669 #> [4,] 5.218785 5.293502 5.361537 5.423469 5.472263 5.786678 6.124166 6.417271 #> [5,] 5.218785 5.195963 5.175182 5.156265 5.047018 4.601556 4.153149 3.700411 #> [6,] 5.218785 5.230266 5.240720 5.250237 5.223344 4.937395 4.631919 4.325631 #> [7,] 5.218785 5.282779 5.341050 5.394094 5.446232 5.704690 5.960200 6.225912 #> [8,] 5.218785 5.200649 5.184135 5.169103 5.222029 5.295458 5.332653 5.411514 #> [9,] 5.218785 5.279000 5.333830 5.383741 5.473599 5.693265 5.883558 6.008571 #> [10,] 5.218785 5.198509 5.180047 5.163240 5.211158 5.363134 5.484012 5.637455 #> [11,] 5.218785 5.227018 5.234515 5.241340 5.304566 5.313421 5.286109 5.215118 #> [12,] 5.218785 5.239073 5.257546 5.274363 5.340150 5.743637 6.157576 6.537356 #> [13,] 5.218785 5.244152 5.267250 5.288277 5.368849 5.736155 6.095455 6.446130 #> [14,] 5.218785 5.188637 5.161185 5.136196 5.180139 5.133185 5.054165 4.939963 #> [15,] 5.218785 5.276621 5.329284 5.377224 5.485817 5.947800 6.413408 6.818895 #> [16,] 5.218785 5.186264 5.156651 5.129695 5.164067 5.036003 4.911462 4.819635 #> [17,] 5.218785 5.287589 5.350239 5.407270 5.441843 5.302190 5.130599 4.917621 #> [18,] 5.218785 5.175766 5.136595 5.100937 5.133176 5.042906 4.927881 4.805144 #> [19,] 5.218785 5.214149 5.209928 5.206085 5.209216 5.221643 5.207986 5.154850 #> [20,] 5.218785 5.202899 5.188434 5.175267 5.123293 5.190363 5.263994 5.290470 #> [21,] 5.218785 5.245528 5.269879 5.292046 5.307134 5.550769 5.803475 6.006355 #> [22,] 5.218785 5.198138 5.179338 5.162224 5.110817 5.285735 5.500451 5.685353 #> [23,] 5.218785 5.199231 5.181426 5.165218 5.132351 4.848629 4.611113 4.419934 #> [24,] 5.218785 5.219417 5.219992 5.220515 5.280947 5.618210 5.947858 6.330842 #> [25,] 5.218785 5.261010 5.299458 5.334458 5.310898 5.136669 4.941532 4.815785 #> [26,] 5.218785 5.225536 5.231682 5.237278 5.285334 5.639643 5.998164 6.327144 #> [27,] 5.218785 5.202733 5.188117 5.174812 5.228391 5.615898 6.005215 6.412908 #> [28,] 5.218785 5.260122 5.297763 5.332027 5.297039 4.976908 4.640029 4.317180 #> [29,] 5.218785 5.271512 5.319523 5.363228 5.429669 5.726449 6.015374 6.267424 #> [30,] 5.218785 5.169249 5.124143 5.083084 5.107385 5.379730 5.641985 5.849738 #> [31,] 5.218785 5.217386 5.216112 5.214952 5.278433 5.188811 5.102778 5.028326 #> [32,] 5.218785 5.260436 5.298362 5.332886 5.362919 5.191334 5.074601 5.004788 #> [33,] 5.218785 5.207866 5.197923 5.188872 5.232577 5.637238 6.063064 6.491669 #> [34,] 5.218785 5.267962 5.312741 5.353504 5.236125 4.894242 4.572600 4.267741 #> [35,] 5.218785 5.286869 5.348865 5.405299 5.514157 5.978055 6.449561 6.871064 #> [36,] 5.218785 5.301111 5.376074 5.444313 5.518751 5.605751 5.659627 5.653455 #> [37,] 5.218785 5.212028 5.205876 5.200275 5.260609 5.173897 5.098310 5.039974 #> [38,] 5.218785 5.222129 5.225174 5.227945 5.240112 5.158481 5.044407 4.897798 #> [39,] 5.218785 5.221748 5.224446 5.226901 5.288257 5.190846 5.076990 4.956598 #> [40,] 5.218785 5.220763 5.222564 5.224203 5.289824 5.215720 5.162853 5.129498 #> [41,] 5.218785 5.245187 5.269228 5.291112 5.157586 4.546599 3.984940 3.546996 #> [42,] 5.218785 5.229603 5.239454 5.248421 5.212999 4.866690 4.514398 4.156208 #> [43,] 5.218785 5.222377 5.225647 5.228625 5.296203 5.435651 5.539855 5.588185 #> [44,] 5.218785 5.282754 5.341001 5.394024 5.505676 5.934554 6.357357 6.724004 #> [45,] 5.218785 5.274000 5.324278 5.370045 5.380639 5.086070 4.794076 4.536810 #> [46,] 5.218785 5.248281 5.275138 5.299586 5.274986 4.947289 4.662972 4.437747 #> [47,] 5.218785 5.247768 5.274160 5.298184 5.382507 5.505057 5.589018 5.676550 #> [48,] 5.218785 5.261708 5.300792 5.336370 5.428934 5.881260 6.343843 6.853972 #> [49,] 5.218785 5.249253 5.276995 5.302250 5.363156 5.243541 5.103219 4.941002 #> [50,] 5.218785 5.299433 5.372868 5.439716 5.410311 5.357270 5.307019 5.230917 #> [51,] 5.218785 5.199250 5.181462 5.165270 5.026200 4.980884 4.994467 5.103672 #> [52,] 5.218785 5.222314 5.225528 5.228454 5.123105 4.925146 4.735607 4.511764 #> [53,] 5.218785 5.275814 5.327743 5.375013 5.473591 5.410980 5.359809 5.322853 #> [54,] 5.218785 5.221853 5.224646 5.227189 5.295398 5.241357 5.219674 5.248008 #> [55,] 5.218785 5.185431 5.155060 5.127414 5.034581 4.923961 4.813524 4.661229 #> [56,] 5.218785 5.266146 5.309272 5.348529 5.359687 5.253514 5.118708 4.947268 #> [57,] 5.218785 5.227927 5.236252 5.243829 5.312365 5.336300 5.323173 5.271044 #> [58,] 5.218785 5.244226 5.267391 5.288479 5.366722 5.283268 5.203157 5.218882 #> [59,] 5.218785 5.225822 5.232229 5.238062 5.302097 5.623029 5.931280 6.175884 #> [60,] 5.218785 5.227597 5.235620 5.242924 5.257524 5.309599 5.336803 5.310628 #> [61,] 5.218785 5.183789 5.151923 5.122915 4.994942 4.814291 4.646096 4.447401 #> [62,] 5.218785 5.209660 5.201351 5.193787 5.083109 4.581521 4.089019 3.603854 #> [63,] 5.218785 5.243774 5.266528 5.287242 5.320619 5.656004 6.015790 6.341412 #> [64,] 5.218785 5.208292 5.198738 5.190041 5.145497 5.073198 4.985910 4.857013 #> [65,] 5.218785 5.198747 5.180502 5.163893 5.191514 5.177572 5.128340 5.033980 #> [66,] 5.218785 5.198889 5.180773 5.164282 5.201926 5.473277 5.733980 5.933278 #> [67,] 5.218785 5.223879 5.228518 5.232740 5.085735 4.851978 4.654499 4.461760 #> [68,] 5.218785 5.205822 5.194019 5.183275 5.185708 5.385840 5.582415 5.797376 #> [69,] 5.218785 5.256985 5.291768 5.323431 5.411721 5.340672 5.275896 5.309790 #> [70,] 5.218785 5.218446 5.218137 5.217856 5.253202 5.615925 5.995394 6.324765 #> [71,] 5.218785 5.185899 5.155954 5.128695 5.142420 4.985937 4.863816 4.777032 #> [72,] 5.218785 5.230327 5.240836 5.250403 5.175711 4.720647 4.280769 3.867637 #> [73,] 5.218785 5.225939 5.232453 5.238383 5.276360 5.449417 5.603157 5.770198 #> [74,] 5.218785 5.181585 5.147712 5.116878 5.151474 5.563346 5.996465 6.476032 #> [75,] 5.218785 5.202328 5.187343 5.173702 5.132594 4.834699 4.519283 4.199791 #> [76,] 5.218785 5.194549 5.172481 5.152392 5.123959 5.101320 5.058688 4.972460 #> [77,] 5.218785 5.201412 5.185592 5.171192 5.059937 4.709003 4.352667 4.008029 #> [78,] 5.218785 5.282467 5.340453 5.393238 5.361993 5.488219 5.661824 5.899875 #> [79,] 5.218785 5.218636 5.218501 5.218378 5.091192 5.058706 5.091154 5.190377 #> [80,] 5.218785 5.174814 5.134775 5.098329 4.977324 5.001159 5.084151 5.178439 #> [81,] 5.218785 5.219415 5.219990 5.220512 5.223436 5.357527 5.480401 5.547241 #> [82,] 5.218785 5.172071 5.129535 5.090814 5.113669 5.333950 5.536132 5.691473 #> [83,] 5.218785 5.243741 5.266465 5.287151 5.355432 5.384810 5.375149 5.314913 #> [84,] 5.218785 5.193949 5.171335 5.150749 5.167246 5.479972 5.800273 6.139083 #> [85,] 5.218785 5.229800 5.239829 5.248959 5.110387 4.958136 4.851126 4.729694 #> [86,] 5.218785 5.232193 5.244402 5.255516 5.217367 4.950597 4.662561 4.371555 #> [87,] 5.218785 5.231881 5.243805 5.254660 5.257045 5.001296 4.733198 4.520914 #> [88,] 5.218785 5.239349 5.258073 5.275118 5.314530 5.248202 5.148901 5.051204 #> [89,] 5.218785 5.200093 5.183072 5.167579 5.038815 4.785103 4.541305 4.368842 #> [90,] 5.218785 5.169673 5.124954 5.084247 4.898400 4.486604 4.097916 3.810523 #> [91,] 5.218785 5.295909 5.366135 5.430062 5.544255 5.617927 5.648544 5.734865 #> [92,] 5.218785 5.236873 5.253344 5.268337 5.321896 5.688119 6.061397 6.382629 #> [93,] 5.218785 5.233812 5.247495 5.259951 5.323908 5.456755 5.555414 5.603583 #> [94,] 5.218785 5.197931 5.178942 5.161656 5.209139 5.511634 5.801467 6.097222 #> [95,] 5.218785 5.193320 5.170132 5.149024 5.196260 5.180351 5.129734 5.084814 #> [96,] 5.218785 5.203739 5.190039 5.177567 5.043368 4.698904 4.361129 4.058022 #> [97,] 5.218785 5.259827 5.297198 5.331217 5.379850 5.214407 5.072050 5.002595 #> [98,] 5.218785 5.273801 5.323897 5.369500 5.474121 5.457175 5.407612 5.331693 #> [99,] 5.218785 5.172767 5.130864 5.092720 5.089917 4.904024 4.701165 4.484930 #> [100,] 5.218785 5.195740 5.174756 5.155654 5.202408 5.438816 5.654171 5.822834 #> s9 s10 #> [1,] 5.927402 6.222819 #> [2,] 5.270268 5.328977 #> [3,] 3.624239 3.236007 #> [4,] 6.696949 6.839651 #> [5,] 3.296471 2.937120 #> [6,] 3.967719 3.622271 #> [7,] 6.580037 6.953947 #> [8,] 5.453674 5.470219 #> [9,] 6.079472 6.086206 #> [10,] 5.777694 5.766377 #> [11,] 5.152954 5.081586 #> [12,] 6.930474 7.353605 #> [13,] 6.857273 7.303556 #> [14,] 4.797655 4.602716 #> [15,] 7.195423 7.607651 #> [16,] 4.814231 4.901869 #> [17,] 4.709643 4.563382 #> [18,] 4.645251 4.414459 #> [19,] 5.057564 4.851003 #> [20,] 5.326155 5.308516 #> [21,] 6.190302 6.419442 #> [22,] 5.885097 6.135522 #> [23,] 4.111615 3.815950 #> [24,] 6.693983 7.082136 #> [25,] 4.889005 4.883234 #> [26,] 6.658665 6.859263 #> [27,] 6.873976 7.278165 #> [28,] 3.886325 3.520089 #> [29,] 6.535621 6.800807 #> [30,] 5.802553 5.661692 #> [31,] 5.016531 4.999249 #> [32,] 4.996442 5.078275 #> [33,] 6.996987 7.519011 #> [34,] 3.990863 3.642472 #> [35,] 7.071085 7.251314 #> [36,] 5.607944 5.470452 #> [37,] 5.015014 5.083688 #> [38,] 4.688437 4.531010 #> [39,] 4.891860 4.872291 #> [40,] 5.131610 5.144257 #> [41,] 3.294555 3.057537 #> [42,] 3.856817 3.610325 #> [43,] 5.637237 5.736643 #> [44,] 7.071430 7.451880 #> [45,] 4.209590 3.911352 #> [46,] 4.222082 4.054900 #> [47,] 5.653117 5.672783 #> [48,] 7.410124 7.902957 #> [49,] 4.791521 4.725684 #> [50,] 5.184100 5.201400 #> [51,] 5.411831 5.750843 #> [52,] 4.125978 3.787460 #> [53,] 5.311637 5.371095 #> [54,] 5.381658 5.600284 #> [55,] 4.501713 4.225085 #> [56,] 4.779075 4.603748 #> [57,] 5.228345 5.243638 #> [58,] 5.432608 5.562611 #> [59,] 6.397523 6.668993 #> [60,] 5.060065 4.743966 #> [61,] 4.077364 3.792006 #> [62,] 3.051793 2.437012 #> [63,] 6.489460 6.576033 #> [64,] 4.522899 4.143080 #> [65,] 4.919847 4.806866 #> [66,] 5.897444 5.783627 #> [67,] 4.331684 4.224703 #> [68,] 5.860147 5.923665 #> [69,] 5.546435 5.838477 #> [70,] 6.624364 6.959013 #> [71,] 4.512992 4.337154 #> [72,] 3.545188 3.209085 #> [73,] 6.030649 6.317897 #> [74,] 6.919029 7.179759 #> [75,] 3.789642 3.462192 #> [76,] 4.663420 4.291896 #> [77,] 3.601196 3.273293 #> [78,] 6.261965 6.660436 #> [79,] 5.411902 5.685791 #> [80,] 5.334165 5.552043 #> [81,] 5.577896 5.598219 #> [82,] 5.872446 6.085384 #> [83,] 5.263152 5.272884 #> [84,] 6.465270 6.749208 #> [85,] 4.633245 4.483593 #> [86,] 3.993060 3.696097 #> [87,] 4.457317 4.408938 #> [88,] 5.015091 4.892148 #> [89,] 4.291893 4.233603 #> [90,] 3.716710 3.651978 #> [91,] 5.996553 6.166579 #> [92,] 6.645962 6.849878 #> [93,] 5.655715 5.567033 #> [94,] 6.467206 6.869962 #> [95,] 5.141495 5.080739 #> [96,] 3.875895 3.628905 #> [97,] 4.946097 4.972352 #> [98,] 5.279264 5.224436 #> [99,] 4.224713 3.962205 #> [100,] 5.897066 5.858305#> 1 #> [1,] 6.222819 #> [2,] 5.328977 #> [3,] 3.236007 #> [4,] 6.839651 #> [5,] 2.937120 #> [6,] 3.622271 #> [7,] 6.953947 #> [8,] 5.470219 #> [9,] 6.086206 #> [10,] 5.766377 #> [11,] 5.081586 #> [12,] 7.353605 #> [13,] 7.303556 #> [14,] 4.602716 #> [15,] 7.607651 #> [16,] 4.901869 #> [17,] 4.563382 #> [18,] 4.414459 #> [19,] 4.851003 #> [20,] 5.308516 #> [21,] 6.419442 #> [22,] 6.135522 #> [23,] 3.815950 #> [24,] 7.082136 #> [25,] 4.883234 #> [26,] 6.859263 #> [27,] 7.278165 #> [28,] 3.520089 #> [29,] 6.800807 #> [30,] 5.661692 #> [31,] 4.999249 #> [32,] 5.078275 #> [33,] 7.519011 #> [34,] 3.642472 #> [35,] 7.251314 #> [36,] 5.470452 #> [37,] 5.083688 #> [38,] 4.531010 #> [39,] 4.872291 #> [40,] 5.144257 #> [41,] 3.057537 #> [42,] 3.610325 #> [43,] 5.736643 #> [44,] 7.451880 #> [45,] 3.911352 #> [46,] 4.054900 #> [47,] 5.672783 #> [48,] 7.902957 #> [49,] 4.725684 #> [50,] 5.201400 #> [51,] 5.750843 #> [52,] 3.787460 #> [53,] 5.371095 #> [54,] 5.600284 #> [55,] 4.225085 #> [56,] 4.603748 #> [57,] 5.243638 #> [58,] 5.562611 #> [59,] 6.668993 #> [60,] 4.743966 #> [61,] 3.792006 #> [62,] 2.437012 #> [63,] 6.576033 #> [64,] 4.143080 #> [65,] 4.806866 #> [66,] 5.783627 #> [67,] 4.224703 #> [68,] 5.923665 #> [69,] 5.838477 #> [70,] 6.959013 #> [71,] 4.337154 #> [72,] 3.209085 #> [73,] 6.317897 #> [74,] 7.179759 #> [75,] 3.462192 #> [76,] 4.291896 #> [77,] 3.273293 #> [78,] 6.660436 #> [79,] 5.685791 #> [80,] 5.552043 #> [81,] 5.598219 #> [82,] 6.085384 #> [83,] 5.272884 #> [84,] 6.749208 #> [85,] 4.483593 #> [86,] 3.696097 #> [87,] 4.408938 #> [88,] 4.892148 #> [89,] 4.233603 #> [90,] 3.651978 #> [91,] 6.166579 #> [92,] 6.849878 #> [93,] 5.567033 #> [94,] 6.869962 #> [95,] 5.080739 #> [96,] 3.628905 #> [97,] 4.972352 #> [98,] 5.224436 #> [99,] 3.962205 #> [100,] 5.858305#> [[1]] #> 1 #> (Intercept) 5.218785 #> #> [[2]] #> 2 #> (Intercept) 5.27089913 #> X1_1 -0.18662895 #> X1_2 0.11697124 #> X1_3 0.65155467 #> X3_1 1.75107270 #> X3_2 -1.22224948 #> X3_3 -1.91731933 #> X4_1 0.10492226 #> X4_2 -4.35160227 #> X4_3 -1.77336031 #> X8_1 0.27485096 #> X8_2 -0.01793876 #> X8_3 -0.44830227 #> X11_1 0.03749511 #> X11_2 -0.10165696 #> X11_3 -0.20105409 #> E 0.40888553 #> #> [[3]] #> 3 #> (Intercept) 5.27089913 #> X1_1 -0.18662895 #> X1_2 0.11697124 #> X1_3 0.65155467 #> X3_1 1.75107270 #> X3_2 -1.22224948 #> X3_3 -1.91731933 #> X4_1 0.10492226 #> X4_2 -4.35160227 #> X4_3 -1.77336031 #> X8_1 0.27485096 #> X8_2 -0.01793876 #> X8_3 -0.44830227 #> X11_1 0.03749511 #> X11_2 -0.10165696 #> X11_3 -0.20105409 #> E 0.40888553 #>