@@ -38,6 +38,7 @@ spBreg_lag <- function(formula, data = list(), listw, na.action, Durbin, type,
38
38
if (! inherits(formula , " formula" )) formula <- as.formula(formula )
39
39
mt <- terms(formula , data = data )
40
40
mf <- lm(formula , data , na.action = na.action , method = " model.frame" )
41
+ have_factor_preds <- have_factor_preds_mf(mf )
41
42
na.act <- attr(mf , " na.action" )
42
43
if (! inherits(listw , " listw" )) stop(" No neighbourhood list" )
43
44
can.sim <- FALSE
@@ -85,6 +86,7 @@ spBreg_lag <- function(formula, data = list(), listw, na.action, Durbin, type,
85
86
if (is.formula(Durbin ) || isTRUE(Durbin )) {
86
87
prefix <- " lag"
87
88
if (isTRUE(Durbin )) {
89
+ if (have_factor_preds ) warn_factor_preds(have_factor_preds )
88
90
WX <- create_WX(x , listw , zero.policy = zero.policy ,
89
91
prefix = prefix )
90
92
} else {
@@ -95,6 +97,9 @@ spBreg_lag <- function(formula, data = list(), listw, na.action, Durbin, type,
95
97
}
96
98
dmf <- lm(Durbin , data1 , na.action = na.fail ,
97
99
method = " model.frame" )
100
+ formula_durbin_factors <- have_factor_preds_mf(dmf )
101
+ if (formula_durbin_factors )
102
+ warn_factor_preds(formula_durbin_factors )
98
103
# dmf <- lm(Durbin, data, na.action=na.action,
99
104
# method="model.frame")
100
105
fx <- try(model.matrix(Durbin , dmf ), silent = TRUE )
@@ -521,6 +526,7 @@ spBreg_err <- function(formula, data = list(), listw, na.action, Durbin, etype,
521
526
if (! inherits(formula , " formula" )) formula <- as.formula(formula )
522
527
mt <- terms(formula , data = data )
523
528
mf <- lm(formula , data , na.action = na.action , method = " model.frame" )
529
+ have_factor_preds <- have_factor_preds_mf(mf )
524
530
na.act <- attr(mf , " na.action" )
525
531
if (! inherits(listw , " listw" )) stop(" No neighbourhood list" )
526
532
can.sim <- FALSE
@@ -563,6 +569,7 @@ spBreg_err <- function(formula, data = list(), listw, na.action, Durbin, etype,
563
569
if (is.formula(Durbin ) || isTRUE(Durbin )) {
564
570
prefix <- " lag"
565
571
if (isTRUE(Durbin )) {
572
+ if (have_factor_preds ) warn_factor_preds(have_factor_preds )
566
573
WX <- create_WX(x , listw , zero.policy = zero.policy ,
567
574
prefix = prefix )
568
575
} else {
@@ -573,6 +580,9 @@ spBreg_err <- function(formula, data = list(), listw, na.action, Durbin, etype,
573
580
}
574
581
dmf <- lm(Durbin , data1 , na.action = na.fail ,
575
582
method = " model.frame" )
583
+ formula_durbin_factors <- have_factor_preds_mf(dmf )
584
+ if (formula_durbin_factors )
585
+ warn_factor_preds(formula_durbin_factors )
576
586
# dmf <- lm(Durbin, data, na.action=na.action,
577
587
# method="model.frame")
578
588
fx <- try(model.matrix(Durbin , dmf ), silent = TRUE )
@@ -998,6 +1008,7 @@ spBreg_sac <- function(formula, data = list(), listw, listw2=NULL, na.action,
998
1008
if (! inherits(formula , " formula" )) formula <- as.formula(formula )
999
1009
mt <- terms(formula , data = data )
1000
1010
mf <- lm(formula , data , na.action = na.action , method = " model.frame" )
1011
+ have_factor_preds <- have_factor_preds_mf(mf )
1001
1012
na.act <- attr(mf , " na.action" )
1002
1013
if (! inherits(listw , " listw" )) stop(" No neighbourhood list" )
1003
1014
if (is.null(listw2 )) listw2 <- listw
@@ -1057,6 +1068,7 @@ spBreg_sac <- function(formula, data = list(), listw, listw2=NULL, na.action,
1057
1068
if (is.formula(Durbin ) || isTRUE(Durbin )) {
1058
1069
prefix <- " lag"
1059
1070
if (isTRUE(Durbin )) {
1071
+ if (have_factor_preds ) warn_factor_preds(have_factor_preds )
1060
1072
WX <- create_WX(x , listw , zero.policy = zero.policy ,
1061
1073
prefix = prefix )
1062
1074
} else {
@@ -1067,6 +1079,9 @@ spBreg_sac <- function(formula, data = list(), listw, listw2=NULL, na.action,
1067
1079
}
1068
1080
dmf <- lm(Durbin , data1 , na.action = na.fail ,
1069
1081
method = " model.frame" )
1082
+ formula_durbin_factors <- have_factor_preds_mf(dmf )
1083
+ if (formula_durbin_factors )
1084
+ warn_factor_preds(formula_durbin_factors )
1070
1085
# dmf <- lm(Durbin, data, na.action=na.action,
1071
1086
# method="model.frame")
1072
1087
fx <- try(model.matrix(Durbin , dmf ), silent = TRUE )
0 commit comments