Description Usage Format Source References Examples
The used.cars
data frame has 48 rows and 2 columns. The data set
includes a neighbours list for the 48 states excluding DC from poly2nb().
1 |
This data frame contains the following columns:
taxes and delivery charges for 1955-9 new cars
1960 used car prices by state
Hanna, F. A. 1966 Effects of regional differences in taxes and transport charges on automobile consumption, in Ostry, S., Rhymes, J. K. (eds) Papers on regional statistical studies, Toronto: Toronto University Press, pp. 199-223.
Hepple, L. W. 1976 A maximum likelihood model for econometric estimation with spatial series, in Masser, I (ed) Theory and practice in regional science, London: Pion, pp. 90-104.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | data(used.cars)
moran.test(used.cars$price.1960, nb2listw(usa48.nb))
moran.plot(used.cars$price.1960, nb2listw(usa48.nb),
labels=rownames(used.cars))
uc.lm <- lm(price.1960 ~ tax.charges, data=used.cars)
summary(uc.lm)
lm.morantest(uc.lm, nb2listw(usa48.nb))
lm.morantest.sad(uc.lm, nb2listw(usa48.nb))
lm.LMtests(uc.lm, nb2listw(usa48.nb))
uc.err <- errorsarlm(price.1960 ~ tax.charges, data=used.cars,
nb2listw(usa48.nb), tol.solve=1.0e-13, control=list(tol.opt=.Machine$double.eps^0.3))
summary(uc.err)
uc.lag <- lagsarlm(price.1960 ~ tax.charges, data=used.cars,
nb2listw(usa48.nb), tol.solve=1.0e-13, control=list(tol.opt=.Machine$double.eps^0.3))
summary(uc.lag)
uc.lag1 <- lagsarlm(price.1960 ~ 1, data=used.cars,
nb2listw(usa48.nb), tol.solve=1.0e-13, control=list(tol.opt=.Machine$double.eps^0.3))
summary(uc.lag1)
uc.err1 <- errorsarlm(price.1960 ~ 1, data=used.cars,
nb2listw(usa48.nb), tol.solve=1.0e-13, control=list(tol.opt=.Machine$double.eps^0.3))
summary(uc.err1)
|
Loading required package: sp
Loading required package: spData
To access larger datasets in this package, install the spDataLarge
package with: `install.packages('spDataLarge',
repos='https://nowosad.github.io/drat/', type='source')`
Loading required package: sf
Linking to GEOS 3.8.0, GDAL 3.0.4, PROJ 6.3.1
Moran I test under randomisation
data: used.cars$price.1960
weights: nb2listw(usa48.nb)
Moran I statistic standard deviate = 8.1752, p-value < 2.2e-16
alternative hypothesis: greater
sample estimates:
Moran I statistic Expectation Variance
0.783561543 -0.021276596 0.009692214
Call:
lm(formula = price.1960 ~ tax.charges, data = used.cars)
Residuals:
Min 1Q Median 3Q Max
-116.701 -45.053 -1.461 43.400 107.807
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1435.7506 27.5796 52.058 < 2e-16 ***
tax.charges 0.6872 0.1754 3.918 0.000294 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 57.01 on 46 degrees of freedom
Multiple R-squared: 0.2503, Adjusted R-squared: 0.234
F-statistic: 15.35 on 1 and 46 DF, p-value: 0.0002939
Global Moran I for regression residuals
data:
model: lm(formula = price.1960 ~ tax.charges, data = used.cars)
weights: nb2listw(usa48.nb)
Moran I statistic standard deviate = 6.3869, p-value = 8.466e-11
alternative hypothesis: greater
sample estimates:
Observed Moran I Expectation Variance
0.574817771 -0.030300549 0.008976437
Saddlepoint approximation for global Moran's I (Barndorff-Nielsen
formula)
data:
model:lm(formula = price.1960 ~ tax.charges, data = used.cars)
weights: nb2listw(usa48.nb)
Saddlepoint approximation = 5.6688, p-value = 7.19e-09
alternative hypothesis: greater
sample estimates:
Observed Moran I
0.5748178
Lagrange multiplier diagnostics for spatial dependence
data:
model: lm(formula = price.1960 ~ tax.charges, data = used.cars)
weights: nb2listw(usa48.nb)
LMErr = 31.793, df = 1, p-value = 1.715e-08
Registered S3 methods overwritten by 'spatialreg':
method from
residuals.stsls spdep
deviance.stsls spdep
coef.stsls spdep
print.stsls spdep
summary.stsls spdep
print.summary.stsls spdep
residuals.gmsar spdep
deviance.gmsar spdep
coef.gmsar spdep
fitted.gmsar spdep
print.gmsar spdep
summary.gmsar spdep
print.summary.gmsar spdep
print.lagmess spdep
summary.lagmess spdep
print.summary.lagmess spdep
residuals.lagmess spdep
deviance.lagmess spdep
coef.lagmess spdep
fitted.lagmess spdep
logLik.lagmess spdep
fitted.SFResult spdep
print.SFResult spdep
fitted.ME_res spdep
print.ME_res spdep
print.lagImpact spdep
plot.lagImpact spdep
summary.lagImpact spdep
HPDinterval.lagImpact spdep
print.summary.lagImpact spdep
print.sarlm spdep
summary.sarlm spdep
residuals.sarlm spdep
deviance.sarlm spdep
coef.sarlm spdep
vcov.sarlm spdep
fitted.sarlm spdep
logLik.sarlm spdep
anova.sarlm spdep
predict.sarlm spdep
print.summary.sarlm spdep
print.sarlm.pred spdep
as.data.frame.sarlm.pred spdep
residuals.spautolm spdep
deviance.spautolm spdep
coef.spautolm spdep
fitted.spautolm spdep
print.spautolm spdep
summary.spautolm spdep
logLik.spautolm spdep
print.summary.spautolm spdep
print.WXImpact spdep
summary.WXImpact spdep
print.summary.WXImpact spdep
predict.SLX spdep
Warning message:
Function errorsarlm moved to the spatialreg package
Call:spatialreg::errorsarlm(formula = formula, data = data, listw = listw,
na.action = na.action, Durbin = Durbin, etype = etype, method = method,
quiet = quiet, zero.policy = zero.policy, interval = interval,
tol.solve = tol.solve, trs = trs, control = control)
Residuals:
Min 1Q Median 3Q Max
-74.8241 -17.4590 2.4061 21.2784 64.5967
Type: error
Coefficients: (asymptotic standard errors)
Estimate Std. Error z value Pr(>|z|)
(Intercept) 1528.34521 31.96239 47.8170 <2e-16
tax.charges 0.08831 0.11923 0.7406 0.4589
Lambda: 0.81899, LR test value: 40.899, p-value: 1.603e-10
Asymptotic standard error: 0.074052
z-value: 11.06, p-value: < 2.22e-16
Wald statistic: 122.32, p-value: < 2.22e-16
Log likelihood: -240.7163 for error model
ML residual variance (sigma squared): 1043.9, (sigma: 32.309)
Number of observations: 48
Number of parameters estimated: 4
AIC: 489.43, (AIC for lm: 528.33)
Warning message:
Function lagsarlm moved to the spatialreg package
Call:spatialreg::lagsarlm(formula = formula, data = data, listw = listw,
na.action = na.action, Durbin = Durbin, type = type, method = method,
quiet = quiet, zero.policy = zero.policy, interval = interval,
tol.solve = tol.solve, trs = trs, control = control)
Residuals:
Min 1Q Median 3Q Max
-77.6781 -16.9505 4.2498 19.5486 58.9811
Type: lag
Coefficients: (asymptotic standard errors)
Estimate Std. Error z value Pr(>|z|)
(Intercept) 309.42997 123.03283 2.5150 0.0119
tax.charges 0.16711 0.10212 1.6364 0.1018
Rho: 0.78302, LR test value: 42.681, p-value: 6.4426e-11
Asymptotic standard error: 0.081637
z-value: 9.5914, p-value: < 2.22e-16
Wald statistic: 91.995, p-value: < 2.22e-16
Log likelihood: -239.8252 for lag model
ML residual variance (sigma squared): 1036.7, (sigma: 32.197)
Number of observations: 48
Number of parameters estimated: 4
AIC: 487.65, (AIC for lm: 528.33)
LM test for residual autocorrelation
test value: 2.1139, p-value: 0.14596
Warning message:
Function lagsarlm moved to the spatialreg package
Call:spatialreg::lagsarlm(formula = formula, data = data, listw = listw,
na.action = na.action, Durbin = Durbin, type = type, method = method,
quiet = quiet, zero.policy = zero.policy, interval = interval,
tol.solve = tol.solve, trs = trs, control = control)
Residuals:
Min 1Q Median 3Q Max
-76.1518 -18.2214 5.2489 21.6309 63.4983
Type: lag
Coefficients: (asymptotic standard errors)
Estimate Std. Error z value Pr(>|z|)
(Intercept) 263.50 109.61 2.4038 0.01622
Rho: 0.82919, LR test value: 54.202, p-value: 1.8086e-13
Asymptotic standard error: 0.070993
z-value: 11.68, p-value: < 2.22e-16
Wald statistic: 136.42, p-value: < 2.22e-16
Log likelihood: -240.977 for lag model
ML residual variance (sigma squared): 1045.4, (sigma: 32.333)
Number of observations: 48
Number of parameters estimated: 3
AIC: 487.95, (AIC for lm: 540.16)
LM test for residual autocorrelation
test value: 2.1495, p-value: 0.14262
Warning message:
Function errorsarlm moved to the spatialreg package
Call:spatialreg::errorsarlm(formula = formula, data = data, listw = listw,
na.action = na.action, Durbin = Durbin, etype = etype, method = method,
quiet = quiet, zero.policy = zero.policy, interval = interval,
tol.solve = tol.solve, trs = trs, control = control)
Residuals:
Min 1Q Median 3Q Max
-76.1518 -18.2214 5.2489 21.6309 63.4983
Type: error
Coefficients: (asymptotic standard errors)
Estimate Std. Error z value Pr(>|z|)
(Intercept) 1542.607 27.321 56.462 < 2.2e-16
Lambda: 0.82919, LR test value: 54.202, p-value: 1.8086e-13
Asymptotic standard error: 0.070993
z-value: 11.68, p-value: < 2.22e-16
Wald statistic: 136.42, p-value: < 2.22e-16
Log likelihood: -240.977 for error model
ML residual variance (sigma squared): 1045.4, (sigma: 32.333)
Number of observations: 48
Number of parameters estimated: 3
AIC: 487.95, (AIC for lm: 540.16)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.