Predicted values and intervals based on a fitted model object.

# S3 method for splm
predict(
  object,
  newdata,
  se.fit = FALSE,
  scale = NULL,
  df = Inf,
  interval = c("none", "confidence", "prediction"),
  level = 0.95,
  type = c("response", "terms"),
  local,
  terms = NULL,
  na.action = na.fail,
  ...
)

# S3 method for spautor
predict(
  object,
  newdata,
  se.fit = FALSE,
  scale = NULL,
  df = Inf,
  interval = c("none", "confidence", "prediction"),
  level = 0.95,
  type = c("response", "terms"),
  local,
  terms = NULL,
  na.action = na.fail,
  ...
)

# S3 method for splm_list
predict(
  object,
  newdata,
  se.fit = FALSE,
  scale = NULL,
  df = Inf,
  interval = c("none", "confidence", "prediction"),
  level = 0.95,
  type = c("response", "terms"),
  local,
  terms = NULL,
  na.action = na.fail,
  ...
)

# S3 method for spautor_list
predict(
  object,
  newdata,
  se.fit = FALSE,
  scale = NULL,
  df = Inf,
  interval = c("none", "confidence", "prediction"),
  level = 0.95,
  type = c("response", "terms"),
  local,
  terms = NULL,
  na.action = na.fail,
  ...
)

# S3 method for splmRF
predict(object, newdata, local, ...)

# S3 method for spautorRF
predict(object, newdata, local, ...)

# S3 method for splmRF_list
predict(object, newdata, local, ...)

# S3 method for spautorRF_list
predict(object, newdata, local, ...)

# S3 method for spglm
predict(
  object,
  newdata,
  type = c("link", "response", "terms"),
  se.fit = FALSE,
  interval = c("none", "confidence", "prediction"),
  level = 0.95,
  dispersion = NULL,
  terms = NULL,
  local,
  var_correct = TRUE,
  newdata_size,
  na.action = na.fail,
  ...
)

# S3 method for spgautor
predict(
  object,
  newdata,
  type = c("link", "response", "terms"),
  se.fit = FALSE,
  interval = c("none", "confidence", "prediction"),
  level = 0.95,
  dispersion = NULL,
  terms = NULL,
  local,
  var_correct = TRUE,
  newdata_size,
  na.action = na.fail,
  ...
)

# S3 method for spglm_list
predict(
  object,
  newdata,
  type = c("link", "response", "terms"),
  se.fit = FALSE,
  interval = c("none", "confidence", "prediction"),
  level = 0.95,
  dispersion = NULL,
  terms = NULL,
  local,
  var_correct = TRUE,
  newdata_size,
  na.action = na.fail,
  ...
)

# S3 method for spgautor_list
predict(
  object,
  newdata,
  type = c("link", "response", "terms"),
  se.fit = FALSE,
  interval = c("none", "confidence", "prediction"),
  level = 0.95,
  dispersion = NULL,
  terms = NULL,
  local,
  var_correct = TRUE,
  newdata_size,
  na.action = na.fail,
  ...
)

Arguments

object

A fitted model object.

newdata

A data frame or sf object in which to look for variables with which to predict. If a data frame, newdata must contain all variables used by formula(object) and all variables representing coordinates. If an sf object, newdata must contain all variables used by formula(object) and coordinates are obtained from the geometry of newdata. If omitted, missing data from the fitted model object are used.

se.fit

A logical indicating if standard errors are returned. The default is FALSE.

scale

A numeric constant by which to scale the regular standard errors and intervals. Similar to but slightly different than scale for stats::predict.lm(), because predictions form a spatial model may have different residual variances for each observation in newdata. The default is NULL, which returns the regular standard errors and intervals.

df

Degrees of freedom to use for confidence or prediction intervals (ignored if scale is not specified). The default is Inf.

interval

Type of interval calculation. The default is "none". Other options are "confidence" (for confidence intervals) and "prediction" (for prediction intervals). When interval is "none" or "prediction", predictions are returned (and when requested, their corresponding uncertainties). When interval is "confidence", mean estimates are returned (and when requested, their corresponding uncertainties). This "none" behavior differs from that of lm(), as lm() returns confidence uncertainties (in .$se.fit).

level

Tolerance/confidence level. The default is 0.95.

type

The prediction type, either on the response scale, link scale (only for spglm() or spgautor() model objects), or terms scale.

local

A optional logical or list controlling the big data approximation. If omitted, local is set to TRUE or FALSE based on the observed data sample size (i.e., sample size of the fitted model object) -- if the sample size exceeds 10,000, local is set to TRUE, otherwise it is set to FALSE. This default behavior occurs because main computational burden of the big data approximation depends almost exclusively on the observed data sample size, not the number of predictions desired (which we feel is not intuitive at first glance). If local is FALSE, no big data approximation is implemented. If a list is provided, the following arguments detail the big data approximation:

  • method: The big data approximation method. If method = "all", all observations are used and size is ignored. If method = "distance", the size data observations closest (in terms of Euclidean distance) to the observation requiring prediction are used. If method = "covariance", the size data observations with the highest covariance with the observation requiring prediction are used. If random effects and partition factors are not used in estimation and the spatial covariance function is monotone decreasing, "distance" and "covariance" are equivalent. The default is "covariance". Only used with models fit using splm() or spglm().

  • size: The number of data observations to use when method is "distance" or "covariance". The default is 100. Only used with models fit using splm() or spglm().

  • parallel: If TRUE, parallel processing via the parallel package is automatically used. This can significantly speed up computations even when method = "all" (i.e., no big data approximation is used), as predictions are spread out over multiple cores. The default is FALSE.

  • ncores: If parallel = TRUE, the number of cores to parallelize over. The default is the number of available cores on your machine.

When local is a list, at least one list element must be provided to initialize default arguments for the other list elements. If local is TRUE, defaults for local are chosen such that local is transformed into list(size = 100, method = "covariance", parallel = FALSE).

terms

If type is "terms", the type of terms to be returned, specified via either numeric position or name. The default is all terms are included.

na.action

Missing (NA) values in newdata will return an error and should be removed before proceeding.

...

Other arguments. Only used for models fit using splmRF() or spautorRF() where ... indicates other arguments to ranger::predict.ranger().

dispersion

The dispersion of assumed when computing the prediction standard errors for spglm() or spgautor() model objects when family is "nbinomial", "beta", "Gamma", or "inverse.gaussian". If omitted, the model object dispersion parameter is used.

var_correct

A logical indicating whether to return the corrected prediction variances when predicting via models fit using spglm() or spgautor(). The default is TRUE.

newdata_size

The size value for each observation in newdata used when predicting for the binomial family.

Value

For splm or spautor objects, if se.fit is FALSE, predict() returns a vector of predictions or a matrix of predictions with column names fit, lwr, and upr if interval is "confidence"

or "prediction". If se.fit is TRUE, a list with the following components is returned:

  • fit: vector or matrix as above

  • se.fit: standard error of each fit

For splm_list or spautor_list objects, a list that contains relevant quantities for each list element.

For splmRF or spautorRF objects, a vector of predictions. For splmRF_list

or spautorRF_list objects, a list that contains relevant quantities for each list element.

Details

For splm and spautor objects, the (empirical) best linear unbiased predictions (i.e., Kriging predictions) at each site are returned when interval is "none" or "prediction" alongside standard errors. Prediction intervals are also returned if interval is "prediction". When interval is "confidence", the estimated mean is returned alongside standard errors and confidence intervals for the mean. For splm_list and spautor_list objects, predictions and associated intervals and standard errors are returned for each list element.

For splmRF or spautorRF objects, random forest spatial residual model predictions are computed by combining the random forest prediction with the (empirical) best linear unbiased prediction for the residual. Fox et al. (2020) call this approach random forest regression Kriging. For splmRF_list or spautorRF objects, predictions are returned for each list element.

References

Fox, E.W., Ver Hoef, J. M., & Olsen, A. R. (2020). Comparing spatial regression to random forests for large environmental data sets. PloS one, 15(3), e0229509.

Examples

spmod <- splm(sulfate ~ 1,
  data = sulfate,
  spcov_type = "exponential", xcoord = x, ycoord = y
)
predict(spmod, sulfate_preds)
#>         1         2         3         4         5         6         7         8 
#>  1.618435 24.371803  8.945102 16.452377  4.925139 26.795441  2.869041 14.255129 
#>         9        10        11        12        13        14        15        16 
#>  1.527998 14.278871  1.201078 17.125020  1.320418 20.139591 21.295541 11.237529 
#>        17        18        19        20        21        22        23        24 
#> 18.683866  9.663971  1.788953 23.631754  3.275535  2.350008  2.048598  2.010150 
#>        25        26        27        28        29        30        31        32 
#>  3.201960  1.493974 18.623392  7.817861 18.797743  5.125182  1.807167  4.075101 
#>        33        34        35        36        37        38        39        40 
#> 12.427273  3.152303  1.293478  6.957413 18.939770  7.297365 14.674697 15.520246 
#>        41        42        43        44        45        46        47        48 
#> 12.405048 24.918442 17.301734 26.864540  1.603280  8.549257  3.784855 14.937188 
#>        49        50        51        52        53        54        55        56 
#> 24.494371  1.956122 27.204132 13.574770  2.576245  1.914563  7.487318 17.136559 
#>        57        58        59        60        61        62        63        64 
#> 17.014448  1.337634 18.683246 12.688687 15.393346 23.574345  1.579663 17.036054 
#>        65        66        67        68        69        70        71        72 
#> 28.544693  1.288539  1.140777  6.171537  3.437062 10.789035  3.615948 17.829018 
#>        73        74        75        76        77        78        79        80 
#>  8.908869  7.301336  2.126375  1.660542 19.373718  1.280324 16.307787 15.288219 
#>        81        82        83        84        85        86        87        88 
#> 17.793902  3.636393  9.731890  1.843879  1.673207  7.792596  2.326289  1.614190 
#>        89        90        91        92        93        94        95        96 
#>  2.694977 19.431798  4.044955  7.952300 12.423394 25.946812 15.137847 16.654989 
#>        97        98        99       100 
#> 21.603763 20.798900 16.737467 16.730626 
predict(spmod, sulfate_preds, interval = "prediction")
#>           fit        lwr       upr
#> 1    1.618435 -6.4458691  9.682739
#> 2   24.371803 16.8475856 31.896020
#> 3    8.945102  1.0255301 16.864674
#> 4   16.452377  8.6427128 24.262041
#> 5    4.925139 -2.7823585 12.632637
#> 6   26.795441 19.2836818 34.307199
#> 7    2.869041 -5.0546545 10.792737
#> 8   14.255129  6.7727705 21.737488
#> 9    1.527998 -6.3288119  9.384809
#> 10  14.278871  6.6143954 21.943347
#> 11   1.201078 -6.7412477  9.143403
#> 12  17.125020  9.6129332 24.637107
#> 13   1.320418 -6.8475567  9.488393
#> 14  20.139591 12.7287130 27.550469
#> 15  21.295541 13.6157754 28.975307
#> 16  11.237529  3.2332125 19.241846
#> 17  18.683866 11.1027931 26.264939
#> 18   9.663971  1.7928039 17.535138
#> 19   1.788953 -6.1854294  9.763336
#> 20  23.631754 16.0720133 31.191496
#> 21   3.275535 -4.7284202 11.279490
#> 22   2.350008 -5.1135227  9.813539
#> 23   2.048598 -6.0317412 10.128936
#> 24   2.010150 -5.7631079  9.783408
#> 25   3.201960 -4.5302411 10.934161
#> 26   1.493974 -6.3460895  9.334038
#> 27  18.623392 11.1134630 26.133320
#> 28   7.817861 -0.3524618 15.988184
#> 29  18.797743 11.0398095 26.555676
#> 30   5.125182 -2.6982901 12.948653
#> 31   1.807167 -6.3415178  9.955852
#> 32   4.075101 -3.5663732 11.716575
#> 33  12.427273  4.6769673 20.177579
#> 34   3.152303 -4.4463365 10.750943
#> 35   1.293478 -6.8488219  9.435778
#> 36   6.957413 -0.9683646 14.883191
#> 37  18.939770 11.6346562 26.244884
#> 38   7.297365 -0.5228443 15.117575
#> 39  14.674697  6.7673697 22.582024
#> 40  15.520246  7.7948540 23.245638
#> 41  12.405048  4.4262734 20.383823
#> 42  24.918442 17.5864895 32.250394
#> 43  17.301734  9.6310247 24.972444
#> 44  26.864540 19.4240569 34.305024
#> 45   1.603280 -6.2004973  9.407057
#> 46   8.549257  0.4298523 16.668662
#> 47   3.784855 -3.6490992 11.218809
#> 48  14.937188  7.1596394 22.714737
#> 49  24.494371 16.8717764 32.116966
#> 50   1.956122 -6.0097993  9.922043
#> 51  27.204132 19.8157834 34.592480
#> 52  13.574770  6.0621552 21.087384
#> 53   2.576245 -5.1022238 10.254714
#> 54   1.914563 -6.2911949 10.120320
#> 55   7.487318 -0.3755634 15.350200
#> 56  17.136559  9.4820700 24.791047
#> 57  17.014448  9.2249276 24.803968
#> 58   1.337634 -6.4385724  9.113841
#> 59  18.683246 11.3039468 26.062546
#> 60  12.688687  4.7747305 20.602644
#> 61  15.393346  7.8685304 22.918162
#> 62  23.574345 16.0955211 31.053169
#> 63   1.579663 -6.2038712  9.363198
#> 64  17.036054  9.2258934 24.846214
#> 65  28.544693 21.0374571 36.051929
#> 66   1.288539 -6.8107592  9.387838
#> 67   1.140777 -6.9519175  9.233472
#> 68   6.171537 -1.7667540 14.109829
#> 69   3.437062 -4.6208291 11.494953
#> 70  10.789035  3.0605613 18.517508
#> 71   3.615948 -4.3318041 11.563701
#> 72  17.829018 10.5010624 25.156974
#> 73   8.908869  1.3774432 16.440295
#> 74   7.301336 -0.7182311 15.320904
#> 75   2.126375 -6.0821512 10.334901
#> 76   1.660542 -5.8572805  9.178365
#> 77  19.373718 11.6821400 27.065296
#> 78   1.280324 -6.5594020  9.120049
#> 79  16.307787  8.5576064 24.057967
#> 80  15.288219  7.3523742 23.224064
#> 81  17.793902 10.2290340 25.358770
#> 82   3.636393 -3.8379555 11.110742
#> 83   9.731890  1.9565364 17.507243
#> 84   1.843879 -5.9288922  9.616651
#> 85   1.673207 -6.0232268  9.369641
#> 86   7.792596 -0.3486329 15.933825
#> 87   2.326289 -5.6078937 10.260471
#> 88   1.614190 -6.0053643  9.233745
#> 89   2.694977 -4.9535614 10.343516
#> 90  19.431798 12.0731376 26.790459
#> 91   4.044955 -4.0206587 12.110569
#> 92   7.952300  0.1344633 15.770137
#> 93  12.423394  4.4963234 20.350464
#> 94  25.946812 18.4522301 33.441395
#> 95  15.137847  7.2417146 23.033980
#> 96  16.654989  9.0689535 24.241024
#> 97  21.603763 13.8886420 29.318883
#> 98  20.798900 13.5068048 28.090995
#> 99  16.737467  9.3086051 24.166329
#> 100 16.730626  8.7188384 24.742414
augment(spmod, newdata = sulfate_preds, interval = "prediction")
#> Simple feature collection with 100 features and 3 fields
#> Geometry type: POINT
#> Dimension:     XY
#> Bounding box:  xmin: -2283774 ymin: 582930.5 xmax: 1985906 ymax: 3037173
#> Projected CRS: NAD83 / Conus Albers
#> # A tibble: 100 × 4
#>    .fitted .lower .upper            geometry
#>  *   <dbl>  <dbl>  <dbl>         <POINT [m]>
#>  1    1.62  -6.45   9.68  (-1771413 1752976)
#>  2   24.4   16.8   31.9    (1018112 1867127)
#>  3    8.95   1.03  16.9  (-291256.8 1553212)
#>  4   16.5    8.64  24.3    (1274293 1267835)
#>  5    4.93  -2.78  12.6  (-547437.6 1638825)
#>  6   26.8   19.3   34.3    (1445080 1981278)
#>  7    2.87  -5.05  10.8   (-1629090 3037173)
#>  8   14.3    6.77  21.7    (1302757 1039534)
#>  9    1.53  -6.33   9.38  (-1429838 2523494)
#> 10   14.3    6.61  21.9    (1131970 1096609)
#> # ℹ 90 more rows
# \donttest{
sulfate$var <- rnorm(NROW(sulfate)) # add noise variable
sulfate_preds$var <- rnorm(NROW(sulfate_preds)) # add noise variable
sprfmod <- splmRF(sulfate ~ var, data = sulfate, spcov_type = "exponential")
predict(sprfmod, sulfate_preds)
#>          1          2          3          4          5          6          7 
#> -2.3978573 21.8343114 12.7840847 10.4363763 20.0909914 33.7915482  9.9820154 
#>          8          9         10         11         12         13         14 
#> 22.5489027 -1.7436025 22.3953771  7.2975696 28.4473955  9.5337326 21.4004095 
#>         15         16         17         18         19         20         21 
#> 12.1407819  5.9417736  9.7618139  5.9873147  6.2303639 22.4295190  3.8430066 
#>         22         23         24         25         26         27         28 
#>  8.5377398 -1.8077164 -4.7835386 12.7099227 -2.8355000 29.2371207  7.5842707 
#>         29         30         31         32         33         34         35 
#>  9.6848971 -3.2264817 -5.4195718 -2.1578651 10.8135794  3.1404403  7.7137885 
#>         36         37         38         39         40         41         42 
#> -4.9283116 14.6012469  3.1032150 20.2128598  5.7388609  5.5101986 25.5446490 
#>         43         44         45         46         47         48         49 
#>  9.4530052 19.7454231  2.2045568  2.6570397  3.5545005 14.8868615 38.5217510 
#>         50         51         52         53         54         55         56 
#>  7.0153391 36.5458937  6.9518827  8.3651705 -4.9088181  4.9496796 20.9868627 
#>         57         58         59         60         61         62         63 
#> 20.7950217  9.0867983  9.2450115 18.3566363  7.7829309 14.7252566  5.4013552 
#>         64         65         66         67         68         69         70 
#> 12.3279112 33.4559282  4.4396752  0.1663599  0.6860726 16.3821799  2.9182475 
#>         71         72         73         74         75         76         77 
#>  2.0347433 21.6360278  8.6530528  4.4706933 12.1503975  8.5165676 18.3106074 
#>         78         79         80         81         82         83         84 
#>  4.8423632  7.9196940  2.5108236 13.4197102  2.2176850  8.6250756 12.6967600 
#>         85         86         87         88         89         90         91 
#> -4.9463766  2.3343730  7.6698240 -3.5530521 -3.3407028 15.3038129  3.4581906 
#>         92         93         94         95         96         97         98 
#> 14.3959609 16.1006814 22.7670679 13.5520810 10.7217827 13.1812187 11.9919883 
#>         99        100 
#> 15.2375168 17.7198041 
# }
# \donttest{
spgmod <- spglm(presence ~ elev * strat,
  family = "binomial",
  data = moose,
  spcov_type = "exponential"
)
predict(spgmod, moose_preds)
#>            1            2            3            4            5            6 
#>  0.084880621 -0.548909739 -2.246964390 -1.083098204  1.414586230 -3.004130991 
#>            7            8            9           10           11           12 
#> -3.354748125 -2.970379416 -1.047959027 -1.434427696 -0.002017356  1.938444325 
#>           13           14           15           16           17           18 
#> -0.304754183 -1.043356402 -0.555182453 -1.979959656 -1.244432442 -1.647923753 
#>           19           20           21           22           23           24 
#> -1.988795935 -1.440239934 -0.587132375 -1.686470092 -0.973716199 -0.640961690 
#>           25           26           27           28           29           30 
#> -0.847866855 -1.393437360  1.988789050 -3.376490749  0.189134517 -1.187057443 
#>           31           32           33           34           35           36 
#>  0.527880786 -2.136238783 -0.641361784 -1.345868026 -0.143194763 -1.457700773 
#>           37           38           39           40           41           42 
#> -0.350191385 -2.309695772 -1.282328425 -3.417968556  0.293061155 -3.439441329 
#>           43           44           45           46           47           48 
#> -1.788728992 -0.372071779 -3.319861689 -1.042391197 -1.432484555 -2.777658665 
#>           49           50           51           52           53           54 
#> -1.214253146 -1.298040121 -1.715824976 -1.092195201  1.467587781 -2.804783060 
#>           55           56           57           58           59           60 
#> -1.039446153 -1.115911899 -3.025570808 -1.306991766 -4.071373594 -0.571007616 
#>           61           62           63           64           65           66 
#> -1.182822534 -1.560073571 -0.748654406  0.494447437 -1.514827733 -2.944002943 
#>           67           68           69           70           71           72 
#> -1.618400856  0.831151773 -2.675766003 -1.398192457 -2.681244761 -1.744755781 
#>           73           74           75           76           77           78 
#> -0.571465815 -1.257479805 -3.226955458 -1.836319421 -2.891771185 -1.809573264 
#>           79           80           81           82           83           84 
#> -0.847137906  0.341292227 -2.205400668 -0.363865134 -3.012202583 -2.619919822 
#>           85           86           87           88           89           90 
#> -1.343474450 -0.728863285 -2.735450644 -3.092757236 -1.502881979 -4.172876795 
#>           91           92           93           94           95           96 
#> -1.671866118 -1.760779550 -0.225678641 -0.076589222 -0.363366012  0.877386103 
#>           97           98           99          100 
#>  0.477418518 -1.319446197 -0.853936630 -0.126740393 
predict(spgmod, moose_preds, interval = "prediction")
#>              fit        lwr         upr
#> 1    0.084880621 -2.2089776  2.37873887
#> 2   -0.548909739 -3.5309005  2.43308101
#> 3   -2.246964390 -5.0512978  0.55736905
#> 4   -1.083098204 -3.5190621  1.35286569
#> 5    1.414586230 -0.9240137  3.75318615
#> 6   -3.004130991 -5.9175242 -0.09073777
#> 7   -3.354748125 -6.1899659 -0.51953039
#> 8   -2.970379416 -5.6999751 -0.24078377
#> 9   -1.047959027 -4.2537380  2.15781998
#> 10  -1.434427696 -3.8293333  0.96047793
#> 11  -0.002017356 -2.3182329  2.31419817
#> 12   1.938444325 -0.9145329  4.79142155
#> 13  -0.304754183 -2.6668358  2.05732744
#> 14  -1.043356402 -3.4341291  1.34741631
#> 15  -0.555182453 -3.2322492  2.12188434
#> 16  -1.979959656 -4.1971302  0.23721089
#> 17  -1.244432442 -3.5459217  1.05705679
#> 18  -1.647923753 -5.1431664  1.84731886
#> 19  -1.988795935 -4.5704531  0.59286127
#> 20  -1.440239934 -4.0899430  1.20946310
#> 21  -0.587132375 -3.6000904  2.42582565
#> 22  -1.686470092 -3.9898195  0.61687936
#> 23  -0.973716199 -3.3777691  1.43033666
#> 24  -0.640961690 -3.1327564  1.85083305
#> 25  -0.847866855 -3.7890049  2.09327122
#> 26  -1.393437360 -4.5172504  1.73037568
#> 27   1.988789050 -0.3502618  4.32783991
#> 28  -3.376490749 -5.9052869 -0.84769463
#> 29   0.189134517 -2.5745120  2.95278100
#> 30  -1.187057443 -3.5949783  1.22086338
#> 31   0.527880786 -1.6712742  2.72703575
#> 32  -2.136238783 -5.0331566  0.76067903
#> 33  -0.641361784 -3.0600082  1.77728467
#> 34  -1.345868026 -3.9082283  1.21649224
#> 35  -0.143194763 -3.8213341  3.53494458
#> 36  -1.457700773 -3.8646509  0.94924934
#> 37  -0.350191385 -3.3939176  2.69353480
#> 38  -2.309695772 -4.6956989  0.07630731
#> 39  -1.282328425 -3.8282534  1.26359655
#> 40  -3.417968556 -6.3175208 -0.51841631
#> 41   0.293061155 -2.0311246  2.61724693
#> 42  -3.439441329 -5.9874656 -0.89141702
#> 43  -1.788728992 -4.9188588  1.34140081
#> 44  -0.372071779 -2.9101493  2.16600570
#> 45  -3.319861689 -6.1896529 -0.45007051
#> 46  -1.042391197 -3.3926203  1.30783791
#> 47  -1.432484555 -4.1875189  1.32254976
#> 48  -2.777658665 -6.5307574  0.97544006
#> 49  -1.214253146 -3.7349164  1.30641009
#> 50  -1.298040121 -4.1587608  1.56268056
#> 51  -1.715824976 -5.3269014  1.89525142
#> 52  -1.092195201 -3.5044873  1.32009689
#> 53   1.467587781 -1.8207248  4.75590033
#> 54  -2.804783060 -6.5830825  0.97351634
#> 55  -1.039446153 -3.2901444  1.21125207
#> 56  -1.115911899 -4.2509868  2.01916305
#> 57  -3.025570808 -6.1235164  0.07237477
#> 58  -1.306991766 -3.7503778  1.13639430
#> 59  -4.071373594 -7.8197325 -0.32301469
#> 60  -0.571007616 -3.0732422  1.93122696
#> 61  -1.182822534 -3.4860572  1.12041217
#> 62  -1.560073571 -5.8038636  2.68371650
#> 63  -0.748654406 -4.1103090  2.61300017
#> 64   0.494447437 -1.7391792  2.72807408
#> 65  -1.514827733 -4.1852948  1.15563929
#> 66  -2.944002943 -5.4442965 -0.44370935
#> 67  -1.618400856 -5.3025939  2.06579215
#> 68   0.831151773 -1.5514937  3.21379727
#> 69  -2.675766003 -5.2146079 -0.13692408
#> 70  -1.398192457 -3.8615119  1.06512697
#> 71  -2.681244761 -6.3325265  0.97003695
#> 72  -1.744755781 -4.3040964  0.81458485
#> 73  -0.571465815 -3.1762641  2.03333252
#> 74  -1.257479805 -4.6821072  2.16714757
#> 75  -3.226955458 -6.2182314 -0.23567947
#> 76  -1.836319421 -4.6366300  0.96399112
#> 77  -2.891771185 -5.6810422 -0.10250021
#> 78  -1.809573264 -4.6077497  0.98860320
#> 79  -0.847137906 -3.8360804  2.14180457
#> 80   0.341292227 -2.3096923  2.99227673
#> 81  -2.205400668 -4.9596138  0.54881243
#> 82  -0.363865134 -2.7922284  2.06449809
#> 83  -3.012202583 -6.1405033  0.11609816
#> 84  -2.619919822 -5.2563174  0.01647776
#> 85  -1.343474450 -3.9137809  1.22683202
#> 86  -0.728863285 -3.4644215  2.00669494
#> 87  -2.735450644 -6.1749989  0.70409761
#> 88  -3.092757236 -5.7007831 -0.48473133
#> 89  -1.502881979 -4.1879071  1.18214315
#> 90  -4.172876795 -8.2960253 -0.04972829
#> 91  -1.671866118 -5.5652379  2.22150567
#> 92  -1.760779550 -4.5653358  1.04377671
#> 93  -0.225678641 -2.7745389  2.32318159
#> 94  -0.076589222 -3.9986045  3.84542608
#> 95  -0.363366012 -3.4476615  2.72092945
#> 96   0.877386103 -1.5947250  3.34949721
#> 97   0.477418518 -2.1065468  3.06138380
#> 98  -1.319446197 -3.9431765  1.30428406
#> 99  -0.853936630 -3.1207980  1.41292472
#> 100 -0.126740393 -2.5600685  2.30658775
augment(spgmod, newdata = moose_preds, interval = "prediction")
#> Simple feature collection with 100 features and 5 fields
#> Geometry type: POINT
#> Dimension:     XY
#> Bounding box:  xmin: 269386.2 ymin: 1418453 xmax: 419976.2 ymax: 1541763
#> Projected CRS: NAD83 / Alaska Albers
#> # A tibble: 100 × 6
#>     elev strat .fitted .lower  .upper           geometry
#>  * <dbl> <chr>   <dbl>  <dbl>   <dbl>        <POINT [m]>
#>  1  143. L      0.0849 -2.21   2.38   (401239.6 1436192)
#>  2  324. L     -0.549  -3.53   2.43   (352640.6 1490695)
#>  3  158. L     -2.25   -5.05   0.557  (360954.9 1491590)
#>  4  221. M     -1.08   -3.52   1.35   (291839.8 1466091)
#>  5  209. M      1.41   -0.924  3.75   (310991.9 1441630)
#>  6  218. L     -3.00   -5.92  -0.0907 (304473.8 1512103)
#>  7  127. L     -3.35   -6.19  -0.520  (339011.1 1459318)
#>  8  122. L     -2.97   -5.70  -0.241  (342827.3 1463452)
#>  9  191  L     -1.05   -4.25   2.16   (284453.8 1502837)
#> 10  105. L     -1.43   -3.83   0.960  (391343.9 1483791)
#> # ℹ 90 more rows
# }