bayespecon.graph.FlowDesignMatrix

class bayespecon.graph.FlowDesignMatrix(X_dest, X_orig, X_intra, intra_indicator, dist_vec, combined, feature_names, n, k_d, k_o, k)[source]

Combined design matrix for an O-D flow regression.

X_dest[source]

Destination-side characteristics: \(\iota_n \otimes X_d\).

Type:

np.ndarray, shape (N, k_d)

X_orig[source]

Origin-side characteristics: \(X_o \otimes \iota_n\).

Type:

np.ndarray, shape (N, k_o)

X_intra[source]

Intra-zonal characteristics (non-zero only on the diagonal of the flow matrix): rows of X_d selected by vec(I_n). Uses destination-side columns because flow_design_matrix() constructs X_intra = intra_indicator * X_dest.

Type:

np.ndarray, shape (N, k_d)

intra_indicator[source]

Binary indicator for diagonal (intra-zonal) O-D pairs.

Type:

np.ndarray, shape (N,)

dist_vec[source]

Vectorised distance/cost matrix vec(dist) if provided.

Type:

np.ndarray or None, shape (N,)

combined[source]

Full design matrix ready for regression. Column order: intercept | intra_indicator | X_dest (k_d cols) | X_orig (k_o cols) | X_intra (k_d cols) [| dist (1 col if provided)].

Type:

np.ndarray, shape (N, p)

feature_names[source]

Column labels for combined aligned with beta in the flow model.

Type:

list[str]

n[source]

Number of spatial units (n). Flow count is \(N = n^2\).

Type:

int

k_d[source]

Number of destination-side attribute columns.

Type:

int

k_o[source]

Number of origin-side attribute columns.

Type:

int

k[source]

Alias for k_d for backward compatibility. Equal to k_d.

Type:

int

__init__(X_dest, X_orig, X_intra, intra_indicator, dist_vec, combined, feature_names, n, k_d, k_o, k)[source]

Methods

__init__(X_dest, X_orig, X_intra, ...)

Attributes

X_dest

X_orig

X_intra

intra_indicator

dist_vec

combined

feature_names

n

k_d

k_o

k

X_dest[source]
X_intra[source]
X_orig[source]
combined[source]
dist_vec[source]
feature_names[source]
intra_indicator[source]
k[source]
k_d[source]
k_o[source]
n[source]