Skip to content

Commit 81f3642

Browse files
committed
return Durbin factor objects
1 parent dacd801 commit 81f3642

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

R/ML_models.R

+7
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ errorsarlm <- function(formula, data = list(), listw, na.action, weights=NULL,
154154
attr(dvars, "f") <- Durbin
155155
attr(dvars, "inds") <- inds
156156
attr(dvars, "zero_fill") <- zero_fill
157+
attr(dvars, "formula_durbin_factors") <- formula_durbin_factors
157158
}
158159
x <- cbind(x, WX)
159160
m <- NCOL(x)
@@ -507,6 +508,8 @@ errorsarlm <- function(formula, data = list(), listw, na.action, weights=NULL,
507508
hf_calls=get("hf_calls", envir=env), intern_classic=iC,
508509
pWinternal=pWinternal, weights=weights, emixedImps=emixedImps,
509510
dvars=dvars), class=c("Sarlm"))
511+
attr(ret, "have_factor_preds") <- have_factor_preds
512+
510513
rm(env)
511514
GC <- gc()
512515
if (zero.policy) {
@@ -680,6 +683,7 @@ lagsarlm <- function(formula, data = list(), listw,
680683
attr(dvars, "f") <- Durbin
681684
attr(dvars, "inds") <- inds
682685
attr(dvars, "zero_fill") <- zero_fill
686+
attr(dvars, "formula_durbin_factors") <- formula_durbin_factors
683687
}
684688
x <- cbind(x, WX)
685689
m <- NCOL(x)
@@ -887,6 +891,7 @@ lagsarlm <- function(formula, data = list(), listw,
887891
f_calls=get("f_calls", envir=env),
888892
hf_calls=get("hf_calls", envir=env), intern_classic=iC),
889893
class=c("Sarlm"))
894+
attr(ret, "have_factor_preds") <- have_factor_preds
890895
rm(env)
891896
GC <- gc()
892897
if (zero.policy) {
@@ -1051,6 +1056,7 @@ sacsarlm <- function(formula, data = list(), listw, listw2=NULL, na.action,
10511056
attr(dvars, "f") <- Durbin
10521057
attr(dvars, "inds") <- inds
10531058
attr(dvars, "zero_fill") <- zero_fill
1059+
attr(dvars, "formula_durbin_factors") <- formula_durbin_factors
10541060
}
10551061
x <- cbind(x, WX)
10561062
m <- NCOL(x)
@@ -1329,6 +1335,7 @@ sacsarlm <- function(formula, data = list(), listw, listw2=NULL, na.action,
13291335
optimHess=FALSE, insert=FALSE, interval1=interval1,
13301336
interval2=interval2, timings=do.call("rbind", timings)[, c(1, 3)]),
13311337
class=c("Sarlm"))
1338+
attr(ret, "have_factor_preds") <- have_factor_preds
13321339
rm(env)
13331340
GC <- gc()
13341341
if (is.null(llprof)) ret$llprof <- llprof

R/SLX_WX.R

+2
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ lmSLX <- function(formula, data = list(), listw, na.action, weights=NULL, Durbin
100100
attr(dvars, "f") <- Durbin
101101
attr(dvars, "inds") <- inds
102102
attr(dvars, "zero_fill") <- zero_fill
103+
attr(dvars, "formula_durbin_factors") <- formula_durbin_factors
103104
}
104105
x <- cbind(x, WX)
105106
rm(WX)
@@ -214,6 +215,7 @@ lmSLX <- function(formula, data = list(), listw, na.action, weights=NULL, Durbin
214215
tms <- as.character(lm.model$terms)
215216
attr(lm.model, "SLX_call") <- paste(y_name, " ", tms[1], " ", tms[3],
216217
", data = ", d_name, ", listw = ", listw_name, sep="")
218+
attr(lm.model, "have_factor_preds") <- have_factor_preds
217219
class(lm.model) <- c("SlX", class(lm.model))
218220
lm.model
219221
}

R/spBreg.R

+6
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ spBreg_lag <- function(formula, data = list(), listw, na.action, Durbin, type,
130130
attr(dvars, "f") <- Durbin
131131
attr(dvars, "inds") <- inds
132132
attr(dvars, "zero_fill") <- zero_fill
133+
attr(dvars, "formula_durbin_factors") <- formula_durbin_factors
133134
}
134135
x <- cbind(x, WX)
135136
m <- NCOL(x)
@@ -386,6 +387,7 @@ spBreg_lag <- function(formula, data = list(), listw, na.action, Durbin, type,
386387
attr(res, "acc_rate") <- acc_rate
387388
attr(res, "dvars") <- dvars
388389
attr(res, "MH") <- priors$rhoMH
390+
attr(res, "have_factor_preds") <- have_factor_preds
389391
class(res) <- c("MCMC_sar_G", class(res))
390392
res
391393

@@ -613,6 +615,7 @@ spBreg_err <- function(formula, data = list(), listw, na.action, Durbin, etype,
613615
attr(dvars, "f") <- Durbin
614616
attr(dvars, "inds") <- inds
615617
attr(dvars, "zero_fill") <- zero_fill
618+
attr(dvars, "formula_durbin_factors") <- formula_durbin_factors
616619
}
617620
x <- cbind(x, WX)
618621
xcolnames <- colnames(x)
@@ -948,6 +951,7 @@ spBreg_err <- function(formula, data = list(), listw, na.action, Durbin, etype,
948951
attr(res, "n") <- n
949952
attr(res, "k") <- k
950953
attr(res, "MH") <- priors$lambdaMH
954+
attr(res, "have_factor_preds") <- have_factor_preds
951955
class(res) <- c("MCMC_sem_G", class(res))
952956
res
953957

@@ -1112,6 +1116,7 @@ spBreg_sac <- function(formula, data = list(), listw, listw2=NULL, na.action,
11121116
attr(dvars, "f") <- Durbin
11131117
attr(dvars, "inds") <- inds
11141118
attr(dvars, "zero_fill") <- zero_fill
1119+
attr(dvars, "formula_durbin_factors") <- formula_durbin_factors
11151120
}
11161121
x <- cbind(x, WX)
11171122
m <- NCOL(x)
@@ -1383,6 +1388,7 @@ spBreg_sac <- function(formula, data = list(), listw, listw2=NULL, na.action,
13831388
attr(res, "acc_rate1") <- acc_rate1
13841389
attr(res, "acc_rate2") <- acc_rate2
13851390
attr(res, "dvars") <- dvars
1391+
attr(res, "have_factor_preds") <- have_factor_preds
13861392
class(res) <- c("MCMC_sac_G", class(res))
13871393
res
13881394

0 commit comments

Comments
 (0)