Skip to contents

Calibrate a basic GWR model

Usage

gwr_basic(
  formula,
  data,
  bw = NA,
  adaptive = FALSE,
  kernel = c("gaussian", "exp", "bisquare", "tricube", "boxcar"),
  longlat = FALSE,
  p = 2,
  theta = 0,
  optim_bw_range = c(0, Inf),
  hatmatrix = TRUE,
  parallel_method = c("no", "omp", "cuda"),
  parallel_arg = c(0),
  verbose = FALSE
)

# S3 method for gwrm
step(
  object,
  ...,
  criterion = c("AIC"),
  threshold = 3,
  bw = NA,
  optim_bw = c("no", "AIC", "CV")
)

# S3 method for gwrm
plot(x, y, ..., columns)

# S3 method for gwrm
coef(object, ...)

# S3 method for gwrm
fitted(object, ...)

# S3 method for gwrm
residuals(object, ...)

# S3 method for gwrm
predict(object, regression_points, verbose = FALSE, ...)

Arguments

formula

Regresison model.

data

A sf objects.

bw

The bandwidth used in selecting models. If NA or missing, the bandwidth value will be derived from the gwrm object.

adaptive

Whether the bandwidth value is adaptive or not.

kernel

Kernel function used.

longlat

Whether the coordinates

p

Power of the Minkowski distance, default to 2, i.e., Euclidean distance.

theta

Angle in radian to roate the coordinate system, default to 0.

optim_bw_range

Bounds on bandwidth optimization, a vector of two numeric elements. Set to NA_real_ to enable default values selected by the algorithm.

hatmatrix

If TRUE, great circle will be caculated.

parallel_method

Parallel method.

parallel_arg

Parallel method argument.

verbose

Whether to print additional message.

object

A "gwrm" object.

...

Additional arguments.

criterion

The model-selection method. Currently there is only AIC available.

threshold

The threshold of criterion changes. Default to 3.0.

optim_bw

Whether optimize bandwidth after selecting models. Avaliable values are no, AIC, and CV. If no is specified, the bandwidth specified by argument bw is used in calibrating selected models.

x

A "gwrm" object.

y

Ignored.

columns

Column names to plot. If it is missing or non-character value, all coefficient columns are plottd.

regression_points

Data of new locations.

Value

A gwrm object.

A gwrm object.

Functions

  • step(gwrm): Model selection for basic GWR model

  • plot(gwrm): Plot the result of basic GWR model.

  • coef(gwrm): Get coefficients of a basic GWR model.

  • fitted(gwrm): Get fitted values of a basic GWR model.

  • residuals(gwrm): Get residuals of a basic GWR model.

  • predict(gwrm): Predict on new locations.

Examples

data(LondonHP)

# Basic usage
gwr_basic(PURCHASE ~ FLOORSZ + UNEMPLOY, LondonHP, 64, TRUE)
#> Geographically Weighted Regression Model
#> ========================================
#>   Formula: PURCHASE ~ FLOORSZ + UNEMPLOY
#>      Data: LondonHP
#>    Kernel: gaussian
#> Bandwidth: 64 (Nearest Neighbours) 
#> 
#> 
#> Summary of Coefficient Estimates
#> --------------------------------
#>  Coefficient         Min.      1st Qu.       Median      3rd Qu.       Max. 
#>    Intercept    13522.222    32504.015    40577.746    48200.526  58693.596 
#>      FLOORSZ     1121.663     1227.720     1319.804     1626.053   1829.647 
#>     UNEMPLOY  -337280.108  -219604.691  -193278.555  -128408.592  50585.573 
#> 
#> 
#> Diagnostic Information
#> ----------------------
#>   RSS: 652228895037
#>   ENP: 11.04545
#>   EDF: 304.9546
#>    R2: 0.63579
#> R2adj: 0.6225549
#>   AIC: 7682.378
#>  AICc: 7693.041
#> 
#> 

# Bandwidth Optimization
m <- gwr_basic(PURCHASE ~ FLOORSZ + UNEMPLOY + PROF, LondonHP, 'AIC', TRUE)
m
#> Geographically Weighted Regression Model
#> ========================================
#>   Formula: PURCHASE ~ FLOORSZ + UNEMPLOY + PROF
#>      Data: LondonHP
#>    Kernel: gaussian
#> Bandwidth: 20 (Nearest Neighbours) (Optimized accroding to AIC)
#> 
#> 
#> Summary of Coefficient Estimates
#> --------------------------------
#>  Coefficient         Min.      1st Qu.       Median      3rd Qu.         Max. 
#>    Intercept  -283403.492  -202450.678  -146322.221   -26250.365    75680.532 
#>      FLOORSZ      908.249     1095.711     1411.257     1864.155     2482.376 
#>     UNEMPLOY  -982984.259    -5935.799   575766.002  1029212.413  1780751.157 
#>         PROF   -16595.354   143221.798   303155.382   379563.029   480351.828 
#> 
#> 
#> Diagnostic Information
#> ----------------------
#>   RSS: 348701748965
#>   ENP: 40.26956
#>   EDF: 275.7304
#>    R2: 0.8052821
#> R2adj: 0.7767406
#>   AIC: 7506.818
#>  AICc: 7546.36
#> 
#> 

step(m, threshold = 100.0, bw = Inf, optim_bw = "AIC")
#> Geographically Weighted Regression Model
#> ========================================
#>   Formula: PURCHASE ~ FLOORSZ + PROF
#>      Data: LondonHP
#>    Kernel: gaussian
#> Bandwidth: 20 (Nearest Neighbours) (Optimized accroding to AIC)
#> 
#> 
#> Summary of Coefficient Estimates
#> --------------------------------
#>  Coefficient         Min.      1st Qu.      Median     3rd Qu.        Max. 
#>    Intercept  -152579.638  -118714.514  -90913.980  -34294.832   40062.236 
#>      FLOORSZ      911.526     1101.292    1398.171    1856.190    2455.689 
#>         PROF    15980.626   153433.054  240159.824  305365.434  374968.876 
#> 
#> 
#> Diagnostic Information
#> ----------------------
#>   RSS: 370110146208
#>   ENP: 34.53499
#>   EDF: 281.465
#>    R2: 0.7933274
#> R2adj: 0.7678789
#>   AIC: 7521.104
#>  AICc: 7554.126
#> 
#> 

plot(m)


coef(m)
#>       Intercept   FLOORSZ    UNEMPLOY       PROF
#> 0    -23859.461 1107.8783  -68568.676 143091.277
#> 1    -19273.643 1099.6911 -105774.018 137317.019
#> 2    -22341.033 1101.6762  -78733.418 139576.718
#> 3    -16587.207 1091.7319 -127715.686 131959.645
#> 4     -4548.212 1071.6907 -236130.771 118805.428
#> 5     36721.681 1025.9964 -574801.771  69162.505
#> 6     41385.027 1015.8069 -621772.017  64587.380
#> 7     41586.375  980.2804 -702105.052  72971.834
#> 8     57682.066  985.6583 -778290.440  47493.741
#> 9     71221.072  928.7546 -982984.259  43974.217
#> 10    71221.072  928.7546 -982984.259  43974.217
#> 11    74619.469  937.5908 -981068.792  35656.125
#> 12   -36611.744 1293.7533  118242.876 111337.546
#> 13   -41112.698 1326.8599  143987.685 114779.442
#> 14   -40110.478 1320.6462  138194.762 113819.779
#> 15   -33091.101 1294.2362   85744.274 105303.803
#> 16   -23071.257 1285.1642  -11537.358  89797.524
#> 17   -25340.399 1292.3173    9974.365  92655.220
#> 18   -23664.457 1290.9835   -7325.338  90061.119
#> 19   -40788.103 1339.5933  133977.982 112868.944
#> 20   -20594.143 1293.7927  -43903.820  84688.294
#> 21   -19987.938 1293.1533  -51824.798  83716.671
#> 22   -31732.566 1325.2556   56141.817  99498.249
#> 23   -19925.638 1298.6693  -54305.801  83082.941
#> 24   -29725.451 1338.4512   26254.767  95071.690
#> 25   -24568.662 1305.8243   -4546.260  89908.455
#> 26   -34640.129 1347.4549   69428.751 102184.662
#> 27   -30890.868 1345.7680   32633.917  96348.212
#> 28   -32685.382 1338.3860  -49922.575 124119.833
#> 29   -25031.866 1318.5557  -73244.469 112769.198
#> 30   -28116.265 1121.2863   43412.634 129466.851
#> 31   -26149.241 1357.6589  -85303.026 108194.827
#> 32   -28815.881 1363.0023  -76497.373 112363.623
#> 33   -24015.706 1147.3150   39287.822 113082.394
#> 34   -26379.748 1137.6319   53964.126 119851.269
#> 35   -26034.543 1088.9505    2927.169 135083.755
#> 36   -23218.692 1378.8505 -104683.173  98601.243
#> 37   -36255.268 1134.3452  120112.460 139922.245
#> 38   -15897.099 1404.6278 -143720.880  79841.433
#> 39   -21289.621 1413.4258 -124270.598  88403.005
#> 40    -8452.456 1029.1179 -185083.061 128044.334
#> 41    -4320.913 1025.9978 -215601.270 122376.737
#> 42    -4320.913 1025.9978 -215601.270 122376.737
#> 43    -5809.548 1036.7680 -186788.099 122370.745
#> 44    -4341.754 1028.1755 -208168.502 121619.580
#> 45   -10383.573 1409.0873 -165291.742  68025.326
#> 46    -8824.776 1021.5504 -188262.545 129078.178
#> 47   -10137.012 1037.5851 -150487.877 128097.150
#> 48    16566.925 1217.5195 -212082.833  47962.183
#> 49   -18834.233 1038.5697  -92604.819 141155.663
#> 50   -21084.132 1047.5924  -64879.463 143221.798
#> 51   -21084.132 1047.5924  -64879.463 143221.798
#> 52   -27308.114 1047.4202  -27747.822 152371.073
#> 53   -26071.929 1047.7922  -31162.659 150660.710
#> 54     4523.811 1189.1320 -139133.905  73502.804
#> 55    18450.195 1230.7297 -211385.065  40595.420
#> 56   -78025.383 1354.7924  435490.767 178018.253
#> 57   -93045.927 1420.6569  517467.533 196609.487
#> 58  -124481.080 1530.2091  695353.082 238166.572
#> 59  -103520.116 1432.8200  578416.543 214480.538
#> 60  -193744.426 1836.5844 1195282.350 313344.383
#> 61  -193274.433 1827.4748 1186073.610 314044.847
#> 62  -193735.300 1825.3512 1180397.449 315575.882
#> 63  -195926.529 1854.6350 1208500.148 314192.406
#> 64  -197873.004 1886.5766 1239754.544 312166.889
#> 65  -194683.519 1830.6797 1182174.626 316625.208
#> 66  -198909.405 1899.4295 1250951.410 311810.090
#> 67  -197964.562 1879.5361 1230244.102 313695.386
#> 68  -196984.343 1861.0807 1211169.372 315231.984
#> 69  -199370.654 1899.3408 1248412.783 312758.159
#> 70  -195286.393 1830.4182 1177983.402 318069.911
#> 71  -201488.734 1916.1275 1258174.219 313959.437
#> 72  -201075.847 1899.3392 1238432.960 316410.372
#> 73  -122966.902 1459.8109  647646.765 252063.226
#> 74  -204142.372 1958.3516 1295831.472 311457.756
#> 75  -201754.049 1904.2279 1240770.944 316919.889
#> 76  -111809.258 1416.8823  578410.941 239681.550
#> 77  -140907.059 1526.6295  740957.406 274837.743
#> 78  -131236.761 1494.6460  684095.951 262915.812
#> 79   -76973.771 1131.9787  312000.704 225259.894
#> 80  -166798.513 1610.4826  878728.070 309109.787
#> 81   -86408.882 1146.9463  341470.102 244299.111
#> 82  -157393.834 1588.5383  786840.399 300532.618
#> 83   -91026.229 1160.3658  357390.550 252453.030
#> 84   -25368.714 1130.8292   81559.990 128297.807
#> 85   -42356.065 1213.7833   99044.118 153624.002
#> 86   -41753.667 1212.7656   98886.546 152150.647
#> 87   -52290.457 1195.5067  148326.050 176003.075
#> 88   -53536.422 1204.0584  147749.251 177443.631
#> 89   -53110.102 1194.8885  152241.799 177626.600
#> 90   -42906.561 1136.7366  148773.176 162973.927
#> 91   -32589.425 1217.6497   67368.699 131583.483
#> 92   -40843.722 1177.7670  120739.369 153760.651
#> 93  -145324.943 1519.6628  546163.529 313250.136
#> 94   -40386.797 1184.1628  116057.451 151812.256
#> 95   -40386.797 1184.1628  116057.451 151812.256
#> 96   -63693.673 1393.2761   57803.458 167024.604
#> 97  -146913.332 1527.2560  524210.507 318967.579
#> 98   -25772.967 1362.7696  -28933.103  91071.393
#> 99  -150526.185 1539.6434  543690.461 323316.529
#> 100 -144832.760 1486.5406  507171.097 322256.518
#> 101 -151929.878 1551.6849  542438.980 325106.777
#> 102 -146354.685 1477.7322  505330.717 327697.663
#> 103 -141004.141 1404.4299  478929.579 329343.642
#> 104  -54724.575 1397.8204   31856.728 145557.540
#> 105 -151899.631 1525.4163  520851.615 332052.394
#> 106 -136652.717 1343.7679  463386.721 329991.761
#> 107  -65783.213 1384.1013   67412.271 171642.120
#> 108 -163943.930 1649.6199  573121.062 335345.387
#> 109  -34302.484 1363.7123   -1879.183 105520.383
#> 110  -61906.708 1379.5745   59876.558 163408.921
#> 111  -63902.406 1383.8854   62257.153 167059.742
#> 112  -63298.209 1367.4527   70201.259 168259.170
#> 113 -183968.599 1906.1663 1114035.672 308271.037
#> 114 -209792.314 2143.1224 1458701.054 300109.720
#> 115 -213246.943 2166.3855 1468408.666 302170.075
#> 116 -213246.943 2166.3855 1468408.666 302170.075
#> 117 -210074.356 2140.1829 1440752.767 302284.363
#> 118 -183629.433 1906.6000 1139288.166 306983.913
#> 119 -183993.702 1906.1384 1109886.220 309212.354
#> 120 -211804.106 2143.6217 1419408.634 306323.115
#> 121 -253005.740 2265.0371 1370802.789 355680.491
#> 122 -253005.740 2265.0371 1370802.789 355680.491
#> 123 -274609.504 2261.1436 1550146.420 384463.687
#> 124 -273937.830 2273.4631 1546274.739 380747.174
#> 125 -253697.283 2246.2771 1388624.390 358241.762
#> 126 -206840.192 2098.9941 1361132.055 307846.578
#> 127 -206840.192 2098.9941 1361132.055 307846.578
#> 128 -263024.542 2195.0258 1465714.426 381322.743
#> 129 -270635.461 2219.7017 1526105.795 386272.348
#> 130 -272066.870 2214.6770 1540644.182 388321.284
#> 131 -272066.870 2214.6770 1540644.182 388321.284
#> 132 -272079.659 2198.1240 1553363.326 388180.809
#> 133 -235777.875 2061.2737 1263976.447 369054.706
#> 134 -261706.572 2110.3258 1445845.135 393564.654
#> 135 -254731.596 2113.1494 1412781.954 384817.765
#> 136 -259503.610 2064.1820 1419938.337 397565.035
#> 137 -258036.926 2101.5268 1431673.539 390736.463
#> 138 -264122.205 2208.2201 1597252.244 375067.867
#> 139 -265448.390 2130.8937 1523111.088 392814.994
#> 140 -248885.929 1984.5707 1303652.667 399801.952
#> 141 -279219.764 2268.7836 1780751.157 379345.412
#> 142 -106422.532 1255.2841  307829.406 281862.698
#> 143  -90130.375  975.2943  296861.750 303719.651
#> 144   32993.857  912.6665  -25733.363  46812.090
#> 145 -102823.614 1248.8238  290192.497 275297.248
#> 146   33310.199  915.6290   34428.970  25819.327
#> 147   -6129.054  916.6483  200930.983  93245.565
#> 148  -87080.550  967.1367  280205.225 301798.130
#> 149   34926.743  913.5507   14063.087  27206.439
#> 150   32979.912  916.9892   31195.599  27460.728
#> 151 -101418.346 1247.6201  281882.055 272619.900
#> 152  -65242.960  935.8904  211718.575 263563.062
#> 153   23783.236  917.5440   81913.187  39732.241
#> 154   38912.204  917.1887  -22495.545  25687.728
#> 155   69882.546  924.8565 -186561.929 -16241.233
#> 156   69882.546  924.8565 -186561.929 -16241.233
#> 157 -220114.101 2250.7113 1615287.068 302591.113
#> 158   75680.532  922.7330 -237153.620 -16595.354
#> 159   44065.949  922.1580  -57014.463  20137.213
#> 160   24849.866  921.0858   61272.655  42016.637
#> 161   44226.644  925.5689  -57629.253  19454.057
#> 162   -2678.568  908.2490  195129.322  86609.356
#> 163 -218354.071 2203.3357 1586624.357 308106.132
#> 164   66702.201  927.2640 -182038.638  -9238.404
#> 165  -24796.663  911.6317  263383.579 131323.332
#> 166 -225630.587 2452.7718 1723723.295 279479.326
#> 167  -39282.423  923.0486  298060.889 161755.717
#> 168  -84730.694 1167.1956  259336.935 244247.937
#> 169  -81907.907 1171.5208  241881.914 237374.318
#> 170  -94606.134 1238.2614  243879.824 259861.513
#> 171 -226743.760 2482.3762 1725632.703 276027.308
#> 172  -83365.769 1166.4158  248518.543 241734.199
#> 173 -226340.398 2317.8543 1638659.114 305914.122
#> 174  -84759.759 1160.6337  257348.335 245823.797
#> 175 -221668.705 2329.8940 1548044.956 299929.659
#> 176 -194759.918 1752.7725  929105.573 381505.707
#> 177 -195129.656 1768.9584  981662.174 375850.711
#> 178 -194052.703 1759.3443  927403.697 379638.693
#> 179 -190654.570 1707.9721  772953.463 394178.986
#> 180 -191406.417 1695.9069  716261.396 402051.169
#> 181 -203763.265 2017.7502 1177656.835 338238.264
#> 182 -201277.267 2001.1566 1128376.805 339155.284
#> 183 -198474.694 1972.8412 1059310.587 343715.421
#> 184 -197355.796 1958.8821 1027800.199 345957.172
#> 185 -202800.333 2008.4550 1144348.189 341545.231
#> 186 -195930.789 1939.1237 1014551.587 349062.843
#> 187 -207768.636 2021.9519 1197288.304 346653.332
#> 188 -207768.636 2021.9519 1197288.304 346653.332
#> 189 -197802.413 1530.0578  609933.161 450072.555
#> 190 -207169.882 2028.6115 1178984.359 346520.414
#> 191 -206509.952 2026.5245 1172478.286 346034.942
#> 192 -206715.400 2027.6282 1167953.120 347149.886
#> 193 -199057.268 1966.2572 1063461.707 347107.596
#> 194 -137105.753 1166.7426  439383.656 374397.109
#> 195 -186608.841 1702.2111  660546.619 409356.648
#> 196 -210597.354 1612.6948  678233.643 457423.506
#> 197 -179454.934 1810.6647 1012255.350 333165.630
#> 198 -180583.931 1810.2878 1025736.258 335130.899
#> 199 -180763.373 1809.4881 1028900.351 335532.599
#> 200 -181077.182 1811.0613 1029524.475 335929.559
#> 201 -179160.823 1812.5585  997629.218 333135.218
#> 202 -179757.639 1813.6065 1002948.396 334034.891
#> 203  -35983.237 1050.9548 -113582.373 182970.385
#> 204 -189019.300 1421.9912  602838.237 445342.324
#> 205  -97599.864 1085.9401  275072.660 310360.048
#> 206  -97599.864 1085.9401  275072.660 310360.048
#> 207  -81675.314 1065.7517  188765.366 279896.365
#> 208 -216979.592 1852.1494  963569.328 409713.895
#> 209 -213844.462 1864.4895  986102.144 399738.351
#> 210 -215403.146 1863.6802  976209.171 403501.341
#> 211  -31362.918 1040.5642 -144789.201 176802.658
#> 212 -187188.101 1705.5391  932200.737 383427.364
#> 213 -217765.714 1868.9346 1003802.364 404267.257
#> 214  -69403.675 1058.7749  102299.099 259040.239
#> 215 -220352.915 1871.1802 1022873.382 406704.731
#> 216 -217480.886 1876.0205 1011974.207 401622.418
#> 217 -220302.356 1874.8819 1032789.661 404909.517
#> 218 -232148.420 1681.0334  819255.932 480122.068
#> 219  -35639.926 1048.8612 -139004.580 190818.451
#> 220  -34927.508 1047.3951 -142988.884 189338.564
#> 221 -219310.812 1878.9996 1024412.293 403118.191
#> 222  -28792.693 1032.5003 -167373.719 175356.373
#> 223 -197143.739 1863.8215  830769.405 385106.338
#> 224 -222930.980 1881.9983 1058135.931 405661.593
#> 225 -223762.909 1882.2014 1063980.614 406556.337
#> 226 -214215.939 1582.0998  719084.024 465381.389
#> 227 -197105.159 1869.0983  817972.033 385155.706
#> 228 -183318.261 1665.6276  900696.888 385187.193
#> 229 -261068.589 1858.6649 1125415.789 476082.591
#> 230 -260606.969 1846.7319 1110739.467 478518.264
#> 231 -183259.555 1672.2453  894299.371 384170.578
#> 232 -259683.437 1834.0735 1094408.425 480351.828
#> 233 -214961.134 1584.4408  728919.631 465726.368
#> 234 -179031.339 1639.6687  896171.238 380794.541
#> 235 -231327.932 1664.8498  829707.490 478625.995
#> 236 -178427.128 1634.7771  892493.508 380680.128
#> 237 -270840.653 1894.2030 1222331.222 476733.970
#> 238 -268653.461 1879.6219 1194730.439 478190.768
#> 239 -201339.902 1917.6566  790984.172 385170.956
#> 240   -5446.985  957.6556 -295179.152 143081.881
#> 241   -5561.775  958.6462 -290121.835 142075.296
#> 242   -5561.775  958.6462 -290121.835 142075.296
#> 243   -7071.014  966.4910 -272207.741 141290.505
#> 244   -7184.705  965.4910 -302102.017 149148.883
#> 245   -9970.831  977.8190 -297961.533 155349.564
#> 246   -8414.991  972.3714 -296203.396 150675.239
#> 247 -179877.745 1682.9628  854011.738 376944.324
#> 248   -9480.627  981.9215 -255100.428 142425.559
#> 249 -182318.374 1702.2505  831173.282 380777.741
#> 250 -201977.508 1939.8453  753373.831 385070.046
#> 251  -15317.128 1000.3804 -280517.834 165480.605
#> 252  -11759.616  988.2017 -285874.615 156691.195
#> 253  -11759.616  988.2017 -285874.615 156691.195
#> 254 -182472.544 1709.1154  833648.576 379487.366
#> 255  -19526.312 1016.5120 -263485.794 173308.195
#> 256  -14713.160 1000.0623 -278727.278 162985.122
#> 257  -13155.596  997.1770 -270715.811 156059.324
#> 258 -180571.694 1705.9064  853153.275 373788.166
#> 259  -25680.657 1054.0299  -99288.854 142302.914
#> 260 -205513.210 1965.4399  758691.628 385355.120
#> 261  -15848.140 1012.0292 -250764.029 157492.917
#> 262  -26351.489 1056.1317  -96430.753 143581.961
#> 263  -28583.728 1061.0439  -85538.406 147793.302
#> 264 -202101.022 1941.5929  763743.561 383015.182
#> 265  -73808.560 1079.9328  138050.080 269583.248
#> 266  -17572.732 1019.2257 -249939.278 162049.727
#> 267 -181868.033 1730.2769  854140.191 371618.790
#> 268 -183290.591 1741.4968  836831.704 374254.228
#> 269  -63506.859 1078.5385   71984.022 248822.673
#> 270  -17789.174 1024.6133 -224816.708 155019.202
#> 271  -55335.689 1077.7769   16587.753 232435.701
#> 272  -19483.285 1033.1694 -223354.243 159090.889
#> 273  -26510.244 1059.3551  -97114.373 144078.606
#> 274  -14369.313 1014.3687 -319467.143 169451.681
#> 275  -28185.003 1063.5982  -89241.103 147349.031
#> 276  -87681.452 1100.4286  232686.961 293368.822
#> 277  -39965.296 1080.8956  -90548.886 201044.788
#> 278 -275800.381 2045.3834 1308612.532 441037.442
#> 279 -283403.492 2002.1007 1390993.773 454040.616
#> 280 -179587.437 1805.0297  648027.534 370759.072
#> 281 -261940.811 2005.8321 1237007.218 429356.415
#> 282 -179608.874 1787.1464  676652.178 371229.855
#> 283 -179608.874 1787.1464  676652.178 371229.855
#> 284 -179075.247 1815.4151  635910.576 368599.877
#> 285 -178835.912 1848.1077  595288.781 365933.284
#> 286 -178835.912 1848.1077  595288.781 365933.284
#> 287 -180713.578 1803.7210  675375.160 370697.690
#> 288 -180359.295 1858.7331  605414.898 366348.047
#> 289 -257315.936 2014.6814 1196296.513 422838.600
#> 290 -257315.936 2014.6814 1196296.513 422838.600
#> 291 -271949.791 1961.9545 1335905.853 444561.271
#> 292 -164178.612 1300.9616  603010.389 411755.380
#> 293 -164178.612 1300.9616  603010.389 411755.380
#> 294 -203905.629 1946.0869  803361.083 376399.740
#> 295 -162543.882 1299.1293  596652.152 408245.055
#> 296 -159553.339 1286.8513  590452.314 403798.940
#> 297 -200857.248 1922.7553  803543.763 374637.196
#> 298 -242352.959 1724.8751 1180500.148 442819.355
#> 299 -172513.554 1332.4961  689527.592 416352.409
#> 300 -203628.168 1932.7010  818126.619 375991.424
#> 301 -163085.568 1303.7578  601060.564 407992.721
#> 302 -170817.621 1327.4445  678172.767 414333.092
#> 303 -237430.009 1712.1826 1129331.641 441340.212
#> 304 -146289.758 1244.6034  532502.169 383851.304
#> 305 -231497.044 1713.4655 1061125.192 437716.510
#> 306 -231497.044 1713.4655 1061125.192 437716.510
#> 307 -167186.917 1318.7074  645874.061 410358.176
#> 308 -159834.006 1292.9478  596615.062 402152.013
#> 309 -164364.712 1315.3763  612881.176 407084.355
#> 310 -217285.056 1640.7157  935289.417 434958.416
#> 311 -216815.581 1633.8806  932161.097 435410.293
#> 312 -213511.226 1604.3888  915380.591 434951.474
#> 313 -210782.000 1537.2801 1011121.106 427192.580
#> 314 -208633.633 1520.0156 1020292.826 424077.075
#> 315 -209256.550 1529.6582 1005234.147 425801.420

fitted(m)
#>   [1] 127499.16 125164.02 112173.27 145740.98 158572.52 158491.40 139519.98
#>   [8] 206972.84 158200.85 310010.65 227351.49 218960.30 143220.87 129807.56
#>  [15]  89995.81 130354.15  90211.23 112505.24 100529.15 135172.39 222632.44
#>  [22] 144012.54 109387.37 181885.59 137308.40  74666.91  82799.36  69315.74
#>  [29] 210992.36 129999.13  84123.75 138678.51 111355.96  91975.56  69502.30
#>  [36] 194693.87 210217.83 134452.03 178036.27 224789.37 245500.73  95455.14
#>  [43]  88273.16 133334.56 124413.89 241427.40  74161.21  78136.69 218928.78
#>  [50] 106340.82 169987.75  95608.69  58249.97  77885.82 184405.09 214704.59
#>  [57]  88850.94 110309.07 126240.73 125366.84 200586.18 139873.13  95789.07
#>  [64]  92625.71 150260.92 126808.83 127488.29 137083.02 198577.49  76197.29
#>  [71] 271355.74 225056.12 186411.25 133664.75  85402.28 104651.96 117459.04
#>  [78] 128036.70 121716.49 152546.57 158933.80  82575.00 238878.12 100010.44
#>  [85]  85791.93 182472.53 120449.76 118575.72  92099.87 113849.31 110690.83
#>  [92] 174556.92  80145.58 136588.43 169086.76 150140.16 115737.39 101469.37
#>  [99] 145227.66 118511.82 167107.16 109243.29  88585.50 242955.79  79378.95
#> [106] 127614.29 121545.07 221263.43  80682.45 113378.86 145492.05 119319.93
#> [113] 116681.58  82661.75 172999.72 138764.74 190757.99 222518.95  85506.44
#> [120]  64904.09 178798.15 190168.79 110892.50 143761.39 154277.19  97604.29
#> [127] 291461.55 257877.64  94640.19 208159.72 165224.00 165224.00 151290.31
#> [134] 167588.66 217979.40 226493.64 171776.77 155648.95 364497.82 167899.98
#> [141] 266448.48 223277.77  96409.28 136769.53 133117.59 146731.33 124868.29
#> [148] 112214.28  89341.76  92785.94 195532.44 159246.64  98452.35 133977.09
#> [155]  92730.06 101848.38 122195.22  99402.13  85875.64 139685.29 151761.46
#> [162] 122298.83  91801.67  71759.19 103465.56 162734.57 191940.83 109429.59
#> [169] 142043.58 105635.98 115799.61 190189.77 153476.63  96799.46  69744.52
#> [176]  59887.01 236669.12 123338.65 258327.69 154163.26 128833.96 266028.69
#> [183] 172463.07 101087.43 168896.74 211663.47 267993.41 157508.20 189859.43
#> [190]  98483.36 182981.98 324772.61 284562.80 111690.74 190104.97 229384.54
#> [197] 102329.40 203315.69  98257.16 199011.39 189526.16  29301.32  85444.79
#> [204] 102182.68 101199.14 126970.15 157376.48 116600.51 201941.58 473638.83
#> [211] 238476.13  69947.46  98368.29 249977.84  94705.44 298782.50 163373.63
#> [218] 259588.75 170418.05 203631.46 128055.58 187735.57  54584.57 116050.19
#> [225] 150223.92 251893.98 151317.37 139859.38  92479.20 184030.61 223807.81
#> [232] 249585.05 136484.75 167951.05 101563.89 243140.99 124537.19 195726.52
#> [239] 392094.05 252110.12  66016.73  59265.33  60223.98  49354.09  83946.82
#> [246]  82585.35 139290.60 145358.97 101306.71 233300.88 105597.50 108233.26
#> [253]  64887.09 120226.38 202500.01 151900.23 123070.09  81415.24 148013.39
#> [260] 108686.92 107389.62 106171.85  97151.90 102545.61 212435.41 156584.38
#> [267] 118789.70 292908.48 234944.84 237834.63 126033.01 134768.95 116266.56
#> [274] 113266.15 117398.56 123036.64 189083.55 177843.09 177311.27 153847.32
#> [281]  95360.61 480631.66 124282.88 106411.42 148410.65  74269.14  76117.24
#> [288]  53838.43 168657.63 186187.34 190216.70 111677.61 129698.53 111485.06
#> [295] 139138.38 119943.11  93029.78 183253.13 165111.37  98423.79 334041.46
#> [302] 157366.98  94506.98 182319.80 132068.58 184899.80 184899.80 100360.59
#> [309]  55561.10  93337.84 148125.06 116780.66 218463.36 237880.69 109360.91
#> [316] 395050.44

residuals(m)
#>   [1]   29500.83727  -11664.02426  -30423.26922    4259.02140   31427.47974
#>   [6]    1458.60153   10475.01914   32977.16014   -5200.85365  -60060.65054
#>  [11]   19648.50946   42039.70312  -40220.86616   -6307.56374   13004.18953
#>  [16]  -30354.14691    -261.23411  -17505.24130  -11029.14767     827.61462
#>  [21]   47367.56215   -9012.53917    5612.62733   13114.41458  -13308.40429
#>  [26]    9333.08684    4200.64287   -5365.73785   19007.64109   12000.86749
#>  [31]   11876.25385  -11678.51497     644.03992    3024.44188     497.70342
#>  [36]  -34693.86840  -23717.82544  -14452.02807   41963.72638   12710.63149
#>  [41]  -15500.72828  -18455.14279  -43273.15800   -8334.55778   50586.11427
#>  [46]  118572.59862  -18661.21422    6863.31313   30071.22026  -36390.82376
#>  [51]  -20037.74660   11391.31341    8250.03190   -8385.82244   10594.91023
#>  [56]   30295.41072   16149.05531   14690.92630   53709.27003   -2366.84458
#>  [61]   24413.81773    7126.86790   13210.92960   -2675.71484  -15260.91514
#>  [66]    2191.17388    7511.71464     -83.02417  -83577.48930    3752.71245
#>  [71]   77644.26079  -45056.12000   19588.74655   -3665.74732    3597.72233
#>  [76]   28348.03682    6040.96237  -46036.70433  -21716.49448  -58046.57171
#>  [81]   42066.20239  -11575.00237    6121.87664    8489.56446    2158.06727
#>  [86]  -60972.52874  -11449.76430  -13580.71536    7850.13103  -15849.30625
#>  [91]  -20690.82730   -5556.92344   49849.42386   -6588.42967  -42086.76106
#>  [96]  -25140.15628   18262.61008  -11469.36813  -10727.66002  -21011.82295
#> [101]    -607.15697   13756.71300    8914.49642   30044.20529    4621.05071
#> [106]   24385.70853  -41545.07111   13736.57301   33817.54901  -14428.85818
#> [111]   12507.95395  -31319.92980    3318.41500    6838.24848    7000.27804
#> [116]  -23764.73635  -45757.98853   27431.05153   29493.55597   22095.90660
#> [121]  -23798.15003  -13168.79464   52107.50309  -58761.39491     722.80916
#> [126]   43395.70695   46538.45119   12122.35639   13359.81497   58340.28028
#> [131]  -20224.00234  -20224.00234  -41290.30711  -15088.66099  -87979.40051
#> [136]    8506.36157  -15276.76663   22851.05298  155502.18157    4100.01917
#> [141]  -56448.48261  -33277.76779    3590.72106  -22658.52640   38882.40555
#> [146]   23268.66954   15131.71422  -12219.28425   -2341.75756   -9785.93731
#> [151]  -33532.43734  -16246.64019  -10952.34853  -43977.08509   21269.94500
#> [156]    5651.62323  -24195.22027   24597.86640  -13375.63822   -1185.29078
#> [161]   26738.54439    9701.17116  -21801.67345   31240.80745      34.44375
#> [166]   35265.43006  -81940.82576   19570.40738  -12048.57904  -30635.97991
#> [171]  -20804.61369   26810.22622  -24476.62995     200.53866   -4744.51983
#> [176]   50112.99191  -56669.11801   48661.34974   36672.30628  130836.74240
#> [181]   48666.04336    8971.30916  -34963.06768   12912.57329   44353.26324
#> [186]  -36663.47176  -47993.40677    -508.19717  -16859.42707   86516.64054
#> [191]    7018.02355  100227.39363   95437.19629    9309.25936    9895.02655
#> [196]   -9384.54294   62670.59588   42184.31393   16692.84121  -44011.39370
#> [201]  -52526.15594   23698.67980   16555.20583  -10187.68443   47300.86169
#> [206]    4029.84765  -22376.47570  -21600.50987    9058.41689  -83638.83347
#> [211]   -3476.13277    3552.53670    -368.29161   28022.16433   -6705.44183
#> [216]  -28782.50157  -21373.63361    8411.24766   39581.94822    9368.53761
#> [221]   -4055.58195  -14235.56999   -9584.57147  -33050.18664    8776.07788
#> [226]   43106.01529  -24817.37303     140.61709    5020.80237    5919.38837
#> [231]  -33807.81101  -31585.05478  -21484.75357   -2951.04855   32436.10747
#> [236]   37059.00542    7462.81223   -5726.51639  107905.95358  -72110.11678
#> [241]    3978.27173   -1515.33438   -5223.98055   10145.90697  -10446.81953
#> [246]   -6585.35271  -49290.60190  -40358.96573    5193.29488    4699.11568
#> [251]   -1597.50184    1766.73731   -5387.08841   12273.61640  -12500.01008
#> [256]  -26900.22933    4929.91373     584.75547  -16013.38840  -48691.91674
#> [261]   10610.37923   11828.15318   -2651.89966  -23545.61219   10064.59155
#> [266]   28415.61857   14460.30451    -908.48419    8055.15919  -22834.63155
#> [271]     966.99243   13231.04831   19733.44492   21733.84751    7601.43516
#> [276]     963.36391  -19583.55483   32656.90947  -17311.26945    1152.67859
#> [281]  -20360.61001   86868.33594   -4332.88121   12588.58283   -8410.65382
#> [286]   25680.86406   22382.75640   27111.57215   -1657.62824  -24187.33794
#> [291]   -7216.70066    7322.38576   13301.47221  -14535.06494   -4138.38479
#> [296]   37556.88659   14970.22256  -68253.12808  -61611.36563   37076.21451
#> [301]   75958.54098   22633.01610  -17506.98100  -40069.80488  -48068.58408
#> [306]  -24899.80140  -24899.80140   12639.41200   12438.90329   -9337.84319
#> [311]    1874.94495   -6780.65807   19036.63999   17119.30687   20639.08727
#> [316] -115050.44316

predict(m, LondonHP)
#> Simple feature collection with 316 features and 6 fields
#> Geometry type: POINT
#> Dimension:     XY
#> Bounding box:  xmin: 507400 ymin: 159400 xmax: 552300 ymax: 194900
#> CRS:           NA
#> First 10 features:
#>    Intercept   FLOORSZ   UNEMPLOY      PROF     yhat   residual
#> 0 -23859.461 1107.8783  -68568.68 143091.28 127499.2  29500.837
#> 1 -19273.643 1099.6911 -105774.02 137317.02 125164.0 -11664.024
#> 2 -22341.033 1101.6762  -78733.42 139576.72 112173.3 -30423.269
#> 3 -16587.207 1091.7319 -127715.69 131959.65 145741.0   4259.021
#> 4  -4548.212 1071.6907 -236130.77 118805.43 158572.5  31427.480
#> 5  36721.681 1025.9964 -574801.77  69162.51 158491.4   1458.602
#> 6  41385.027 1015.8069 -621772.02  64587.38 139520.0  10475.019
#> 7  41586.375  980.2804 -702105.05  72971.83 206972.8  32977.160
#> 8  57682.066  985.6583 -778290.44  47493.74 158200.9  -5200.854
#> 9  71221.072  928.7546 -982984.26  43974.22 310010.7 -60060.651
#>                geometry
#> 0 POINT (533200 159400)
#> 1 POINT (533300 159700)
#> 2 POINT (532000 159800)
#> 3 POINT (531900 160100)
#> 4 POINT (532800 160300)
#> 5 POINT (535700 161700)
#> 6 POINT (535600 161800)
#> 7 POINT (533400 161900)
#> 8 POINT (535500 162200)
#> 9 POINT (534200 162500)