LM decision-tree recovery on known DGPs

Does the specification-test decision tree land on the model that generated the data? Each scenario simulates from a known DGP, runs the tree from one or more starting models, and records the terminal recommendation.

This is evidence about the implementation, not a guide to using it — for that see How to run Bayesian LM specification tests.

import warnings

import libpysal
import numpy as np
import pandas as pd

from neighbayes.models import OLS, SAR, SEM, SLX

warnings.filterwarnings("ignore", category=FutureWarning)
warnings.filterwarnings("ignore", category=UserWarning)
import geopandas as gpd
from libpysal.graph import Graph
from libpysal.weights import Rook

# Generate data under H0: no spatial dependence
np.random.seed(42)

# Load Columbus dataset for spatial weights
columbus_path = libpysal.examples.get_path("columbus.shp")
gdf = gpd.read_file(columbus_path)

# Create a Graph (modern libpysal API) for neighbayes models
# Row-standardize the graph so spatial models work correctly
g = Graph.build_contiguity(gdf, rook=True).transform("r")
n = g.n

# Legacy W for spreg comparison
w_spreg = Rook.from_shapefile(columbus_path)
w_spreg.transform = "r"

# Get sparse and dense W matrices
W_sparse = g.sparse.tocsr().astype(np.float64)
W_dense = np.array(W_sparse.todense())

# Design matrix
k = 3
X = np.column_stack([np.ones(n), np.random.normal(size=(n, k - 1))])
beta_true = np.array([1.0, 2.0, -1.5])
y = X @ beta_true + np.random.normal(scale=1.0, size=n)

print(f"W shape: {W_sparse.shape}, nnz: {W_sparse.nnz}")
W shape: (49, 49), nnz: 200

Cross-sectional recovery

Simulate from each cross-sectional DGP, start the decision tree from several plausible models, and record where it lands.

from neighbayes.dgp import (
    simulate_ols,
    simulate_sar,
    simulate_sdem,
    simulate_sdm,
    simulate_sem,
    simulate_slx,
)
from neighbayes.dgp.utils import rook_grid_weights

ALPHA = 0.05
SAMPLE_KW = dict(draws=600, tune=600, chains=2, random_seed=7, progressbar=False)

# 12x12 rook grid (n=144), large enough for stable LM tests but quick to fit.
N_SIDE = 12
W_dense_grid, W_graph = rook_grid_weights(N_SIDE)

beta = np.array([1.0, 2.0])
beta1 = np.array([1.0, 2.0])
beta2 = np.array([1.5])  # WX coefficient — large so LM-WX detects it

COMMON = dict(W=W_graph, seed=42, sigma=1.0)

scenarios = {
    "OLS": simulate_ols(beta=beta, **COMMON),
    "SAR": simulate_sar(rho=0.6, beta=beta, **COMMON),
    "SEM": simulate_sem(lam=0.6, beta=beta, **COMMON),
    "SLX": simulate_slx(beta1=beta1, beta2=beta2, **COMMON),
    "SDM": simulate_sdm(rho=0.5, beta1=beta1, beta2=beta2, **COMMON),
    "SDEM": simulate_sdem(lam=0.5, beta1=beta1, beta2=beta2, **COMMON),
}

for name, d in scenarios.items():
    print(
        f"{name:5s}  n={len(d['y']):3d}  X.shape={d['X'].shape}  "
        f"true params: {list(d['params_true'].keys())}"
    )
OLS    n=144  X.shape=(144, 2)  true params: ['beta', 'sigma']
SAR    n=144  X.shape=(144, 2)  true params: ['rho', 'beta', 'sigma']
SEM    n=144  X.shape=(144, 2)  true params: ['lam', 'beta', 'sigma']
SLX    n=144  X.shape=(144, 2)  true params: ['beta1', 'beta2', 'sigma']
SDM    n=144  X.shape=(144, 2)  true params: ['rho', 'beta1', 'beta2', 'sigma']
SDEM   n=144  X.shape=(144, 2)  true params: ['lam', 'beta1', 'beta2', 'sigma']
/home/runner/micromamba/envs/test/lib/python3.14/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html
  from .autonotebook import tqdm as notebook_tqdm
def to_frame(X):
    """Wrap design matrix in a DataFrame with intercept + x1, x2, ... names."""
    cols = ["intercept"] + [f"x{i}" for i in range(1, X.shape[1])]
    return pd.DataFrame(X, columns=cols)


def fit_start(start_cls, sim, **extra):
    """Fit a starting model on a simulation dict from neighbayes.dgp."""
    Xf = to_frame(sim["X"])
    yf = sim["y"]
    model = start_cls(y=yf, X=Xf, W=W_graph, logdet_method="eigenvalue", **extra)
    model.fit(**SAMPLE_KW)
    return model


def diagnose(model, alpha=ALPHA):
    """Return (recommended_model, diagnostics_df)."""
    diag = model.spatial_diagnostics()
    rec = model.spatial_diagnostics_decision(alpha=alpha, format="model")
    return rec, diag
experiments = [
    ("OLS", OLS, "OLS"),
    ("SAR", OLS, "SAR"),
    ("SEM", OLS, "SEM"),
    ("SLX", OLS, "SLX"),
    ("SLX", SLX, "SLX"),
    ("SDM", SAR, "SDM"),
    ("SDM", SLX, "SDM"),
    ("SDEM", SEM, "SDEM"),
    ("SDEM", SLX, "SDEM"),
]

results = []
fitted = {}
for dgp_name, start_cls, expected in experiments:
    sim = scenarios[dgp_name]
    model = fit_start(start_cls, sim)
    rec, diag = diagnose(model)
    fitted[(dgp_name, start_cls.__name__)] = (model, diag)
    results.append(
        {
            "DGP": dgp_name,
            "Starting model": start_cls.__name__,
            "Recommended": rec,
            "Expected": expected,
            "Match": "yes" if rec == expected else "no",
        }
    )

summary = pd.DataFrame(results)
summary
Initializing NUTS using jitter+adapt_diag...
Multiprocess sampling (2 chains in 2 jobs)
NUTS: [beta, sigma2]
Sampling 2 chains for 600 tune and 600 draw iterations (1_200 + 1_200 draws total) took 2 seconds.
We recommend running at least 4 chains for robust computation of convergence diagnostics
Initializing NUTS using jitter+adapt_diag...
Multiprocess sampling (2 chains in 2 jobs)
NUTS: [beta, sigma2]
Sampling 2 chains for 600 tune and 600 draw iterations (1_200 + 1_200 draws total) took 2 seconds.
We recommend running at least 4 chains for robust computation of convergence diagnostics
Initializing NUTS using jitter+adapt_diag...
Multiprocess sampling (2 chains in 2 jobs)
NUTS: [beta, sigma2]
Sampling 2 chains for 600 tune and 600 draw iterations (1_200 + 1_200 draws total) took 2 seconds.
We recommend running at least 4 chains for robust computation of convergence diagnostics
Initializing NUTS using jitter+adapt_diag...
Multiprocess sampling (2 chains in 2 jobs)
NUTS: [beta, sigma2]
Sampling 2 chains for 600 tune and 600 draw iterations (1_200 + 1_200 draws total) took 2 seconds.
We recommend running at least 4 chains for robust computation of convergence diagnostics
Initializing NUTS using jitter+adapt_diag...
Multiprocess sampling (2 chains in 2 jobs)
NUTS: [beta, sigma2]
Sampling 2 chains for 600 tune and 600 draw iterations (1_200 + 1_200 draws total) took 2 seconds.
We recommend running at least 4 chains for robust computation of convergence diagnostics
Initializing NUTS using jitter+adapt_diag...
Multiprocess sampling (2 chains in 2 jobs)
NUTS: [beta, sigma2]
Sampling 2 chains for 600 tune and 600 draw iterations (1_200 + 1_200 draws total) took 2 seconds.
We recommend running at least 4 chains for robust computation of convergence diagnostics
Initializing NUTS using jitter+adapt_diag...
Multiprocess sampling (2 chains in 2 jobs)
NUTS: [beta, sigma2]
Sampling 2 chains for 600 tune and 600 draw iterations (1_200 + 1_200 draws total) took 2 seconds.
We recommend running at least 4 chains for robust computation of convergence diagnostics
DGP Starting model Recommended Expected Match
0 OLS OLS OLS OLS yes
1 SAR OLS SAR SAR yes
2 SEM OLS SEM SEM yes
3 SLX OLS SLX SLX yes
4 SLX SLX SLX SLX yes
5 SDM SAR SDM SDM yes
6 SDM SLX SDM SDM yes
7 SDEM SEM SDEM SDEM yes
8 SDEM SLX SDEM SDEM yes
for (dgp_name, start_name), (_, diag) in fitted.items():
    rec = summary.query("DGP == @dgp_name and `Starting model` == @start_name").iloc[0]
    print(
        f"\n=== DGP={dgp_name} | start={start_name} | "
        f"recommended={rec['Recommended']} ({rec['Match']} expected {rec['Expected']}) ==="
    )
    print(diag[["statistic", "df", "p_value"]].round(4).to_string())
=== DGP=OLS | start=OLS | recommended=OLS (yes expected OLS) ===
                    statistic  df  p_value
test                                      
LM-Lag                 0.3824   1   0.5363
LM-Error               0.0399   1   0.8418
LM-WX                  0.8636   1   0.3527
LM-SDM-Joint           0.9035   2   0.6365
LM-SLX-Error-Joint     0.9035   2   0.6365
Robust-LM-Lag          0.8636   1   0.3527
Robust-LM-Error        0.5210   1   0.4704
Robust-LM-WX           0.5210   1   0.4704

=== DGP=SAR | start=OLS | recommended=SAR (yes expected SAR) ===
                    statistic  df  p_value
test                                      
LM-Lag                58.4777   1   0.0000
LM-Error              23.7705   1   0.0000
LM-WX                 34.7593   1   0.0000
LM-SDM-Joint          58.5299   2   0.0000
LM-SLX-Error-Joint    58.5299   2   0.0000
Robust-LM-Lag         34.7593   1   0.0000
Robust-LM-Error        0.0522   1   0.8193
Robust-LM-WX           0.0522   1   0.8193

=== DGP=SEM | start=OLS | recommended=SEM (yes expected SEM) ===
                    statistic  df  p_value
test                                      
LM-Lag                 7.3034   1   0.0069
LM-Error              27.5617   1   0.0000
LM-WX                  1.2535   1   0.2629
LM-SDM-Joint          28.8153   2   0.0000
LM-SLX-Error-Joint    28.8153   2   0.0000
Robust-LM-Lag          1.2535   1   0.2629
Robust-LM-Error       21.5118   1   0.0000
Robust-LM-WX          21.5118   1   0.0000

=== DGP=SLX | start=OLS | recommended=SLX (yes expected SLX) ===
                    statistic  df  p_value
test                                      
LM-Lag                20.3652   1   0.0000
LM-Error               0.2460   1   0.6199
LM-WX                 40.2810   1   0.0000
LM-SDM-Joint          40.5270   2   0.0000
LM-SLX-Error-Joint    40.5270   2   0.0000
Robust-LM-Lag         40.2810   1   0.0000
Robust-LM-Error       20.1618   1   0.0000
Robust-LM-WX          20.1618   1   0.0000

=== DGP=SLX | start=SLX | recommended=SLX (yes expected SLX) ===
                      statistic  df  p_value
test                                        
LM-Lag                   0.1074   1   0.7431
LM-Error                 0.0061   1   0.9380
Robust-LM-Lag-SDM        1.0313   1   0.3099
Robust-LM-Error-SDEM     0.9299   1   0.3349

=== DGP=SDM | start=SAR | recommended=SDM (yes expected SDM) ===
                 statistic  df  p_value
test                                   
LM-Error            8.4613   1   0.0036
LM-WX              22.6102   1   0.0000
Robust-LM-WX       14.2915   1   0.0002
Robust-LM-Error     0.1426   1   0.7057

=== DGP=SDM | start=SLX | recommended=SDM (yes expected SDM) ===
                      statistic  df  p_value
test                                        
LM-Lag                  25.7667   1   0.0000
LM-Error                16.4477   1   0.0001
Robust-LM-Lag-SDM        9.3376   1   0.0022
Robust-LM-Error-SDEM     0.0186   1   0.8914

=== DGP=SDEM | start=SEM | recommended=SDEM (yes expected SDEM) ===
               statistic  df  p_value
test                                 
LM-Lag           33.6574   1   0.0000
LM-WX            39.1422   1   0.0000
Robust-LM-Lag     0.6374   1   0.4247
Robust-LM-WX      6.1221   1   0.0133

=== DGP=SDEM | start=SLX | recommended=SDEM (yes expected SDEM) ===
                      statistic  df  p_value
test                                        
LM-Lag                  10.3930   1   0.0013
LM-Error                15.1211   1   0.0001
Robust-LM-Lag-SDM        1.3559   1   0.2443
Robust-LM-Error-SDEM     6.0840   1   0.0136
# ASCII rendering of the full decision tree with the traversed path highlighted.
model_sdm_from_slx, _ = fitted[("SDM", "SLX")]
print(model_sdm_from_slx.spatial_diagnostics_decision(alpha=ALPHA, format="ascii"))
LM-Lag *  (p=0.0000, alpha=0.05)
├── <sig> LM-Error *  (p=0.0001, alpha=0.05)
│   ├── <sig> Robust-LM-Lag-SDM *  (p=0.0022, alpha=0.05)
│   │   ├── <sig> Robust-LM-Error-SDEM *  (p=0.8914, alpha=0.05)
│   │   │   ├── <sig> Robust-LM-Lag-SDM p <= Robust-LM-Error-SDEM p
│   │   │   │   ├── <true> [SDM]
│   │   │   │   └── <false> [SDEM]
│   │   │   └── <not sig> [SDM] * ← SELECTED
│   │   └── <not sig> Robust-LM-Error-SDEM
│   │       ├── <sig> [SDEM]
│   │       └── <not sig> Robust-LM-Lag-SDM p <= Robust-LM-Error-SDEM p
│   │           ├── <true> [SDM]
│   │           └── <false> [SDEM]
│   └── <not sig> [SDM]
└── <not sig> LM-Error
    ├── <sig> [SDEM]
    └── <not sig> [SLX]

Reading the table. Each scenario is one simulated dataset with a strong signal, so a miss here points to routing rather than to low power. Note what each starting model can reach: the OLS tree ends at OLS, SAR, SEM or SLX, so a Durbin model is reached by fitting the model the tree points to and asking again. SARAR and GNS are where the tests point when both remaining terms register; neighbayes does not fit them, so fit the SDM and the SDEM and compare them with bayes_factor_compare_models.

The tree thresholds at a single alpha; for borderline cases read spatial_diagnostics() directly.

Panel recovery

The same sweep over the fixed-effects panel DGPs.

from neighbayes.dgp import (
    simulate_ols,
    simulate_sar,
    simulate_sdem,
    simulate_sdm,
    simulate_sem,
    simulate_slx,
)
from neighbayes.models import OLS, SAR, SEM, SLX

PANEL_N_SIDE = 10
_, W_panel_graph = rook_grid_weights(PANEL_N_SIDE)
PANEL_N = PANEL_N_SIDE * PANEL_N_SIDE
PANEL_T = 5
PANEL_COMMON = dict(N=PANEL_N, T=PANEL_T, W=W_panel_graph, seed=42, sigma=1.0)
PANEL_SAMPLE_KW = dict(draws=400, tune=400, chains=2, random_seed=7, progressbar=False)

panel_scenarios = {
    "OLS": simulate_ols(beta=beta, **PANEL_COMMON, unit_effects="fixed"),
    "SAR": simulate_sar(rho=0.5, beta=beta, **PANEL_COMMON, unit_effects="fixed"),
    "SEM": simulate_sem(lam=0.5, beta=beta, **PANEL_COMMON, unit_effects="fixed"),
    "SLX": simulate_slx(beta1=beta1, beta2=beta2, **PANEL_COMMON, unit_effects="fixed"),
    "SDM": simulate_sdm(
        rho=0.4, beta1=beta1, beta2=beta2, **PANEL_COMMON, unit_effects="fixed"
    ),
    "SDEM": simulate_sdem(
        lam=0.4, beta1=beta1, beta2=beta2, **PANEL_COMMON, unit_effects="fixed"
    ),
}
def fit_panel_start(start_cls, sim):
    Xf = to_frame(sim["X"])
    m = start_cls(
        y=sim["y"],
        X=Xf,
        W=W_panel_graph,
        N=PANEL_N,
        T=PANEL_T,
        unit_effects="fixed",  # two-way fixed effects
        time_effects=True,
    )
    m.fit(**PANEL_SAMPLE_KW)
    return m


panel_experiments = [
    ("OLS", OLS, "OLS"),
    ("SAR", OLS, "SAR"),
    ("SEM", OLS, "SEM"),
    ("SLX", OLS, "SLX"),
    ("SLX", SLX, "SLX"),
    ("SDM", SAR, "SDM"),
    ("SDM", SLX, "SDM"),
    ("SDEM", SEM, "SDEM"),
    ("SDEM", SLX, "SDEM"),
]

panel_results = []
panel_fitted = {}
for dgp_name, start_cls, expected in panel_experiments:
    m = fit_panel_start(start_cls, panel_scenarios[dgp_name])
    diag = m.spatial_diagnostics()
    rec = m.spatial_diagnostics_decision(alpha=ALPHA, format="model")
    panel_fitted[(dgp_name, start_cls.__name__)] = (m, diag)
    panel_results.append(
        {
            "DGP": dgp_name,
            "Starting model": start_cls.__name__,
            "Recommended": rec,
            "Expected": expected,
            "Match": "yes" if rec == expected else "no",
        }
    )

panel_summary = pd.DataFrame(panel_results)
panel_summary
Initializing NUTS using jitter+adapt_diag...
Multiprocess sampling (2 chains in 2 jobs)
NUTS: [beta, sigma2]
Sampling 2 chains for 400 tune and 400 draw iterations (800 + 800 draws total) took 2 seconds.
We recommend running at least 4 chains for robust computation of convergence diagnostics
Initializing NUTS using jitter+adapt_diag...
Multiprocess sampling (2 chains in 2 jobs)
NUTS: [beta, sigma2]
Sampling 2 chains for 400 tune and 400 draw iterations (800 + 800 draws total) took 2 seconds.
We recommend running at least 4 chains for robust computation of convergence diagnostics
Initializing NUTS using jitter+adapt_diag...
Multiprocess sampling (2 chains in 2 jobs)
NUTS: [beta, sigma2]
Sampling 2 chains for 400 tune and 400 draw iterations (800 + 800 draws total) took 2 seconds.
We recommend running at least 4 chains for robust computation of convergence diagnostics
Initializing NUTS using jitter+adapt_diag...
Multiprocess sampling (2 chains in 2 jobs)
NUTS: [beta, sigma2]
Sampling 2 chains for 400 tune and 400 draw iterations (800 + 800 draws total) took 2 seconds.
We recommend running at least 4 chains for robust computation of convergence diagnostics
The rhat statistic is larger than 1.01 for some parameters. This indicates problems during sampling. See https://arxiv.org/abs/1903.08008 for details
Initializing NUTS using jitter+adapt_diag...
Multiprocess sampling (2 chains in 2 jobs)
NUTS: [beta, sigma2]
Sampling 2 chains for 400 tune and 400 draw iterations (800 + 800 draws total) took 2 seconds.
We recommend running at least 4 chains for robust computation of convergence diagnostics
Initializing NUTS using jitter+adapt_diag...
Multiprocess sampling (2 chains in 2 jobs)
NUTS: [beta, sigma2]
Sampling 2 chains for 400 tune and 400 draw iterations (800 + 800 draws total) took 2 seconds.
We recommend running at least 4 chains for robust computation of convergence diagnostics
Initializing NUTS using jitter+adapt_diag...
Multiprocess sampling (2 chains in 2 jobs)
NUTS: [beta, sigma2]
Sampling 2 chains for 400 tune and 400 draw iterations (800 + 800 draws total) took 2 seconds.
We recommend running at least 4 chains for robust computation of convergence diagnostics
DGP Starting model Recommended Expected Match
0 OLS OLS OLS OLS yes
1 SAR OLS SAR SAR yes
2 SEM OLS SEM SEM yes
3 SLX OLS SLX SLX yes
4 SLX SLX SLX SLX yes
5 SDM SAR SDM SDM yes
6 SDM SLX SDM SDM yes
7 SDEM SEM SDEM SDEM yes
8 SDEM SLX SDEM SDEM yes
for (dgp_name, start_name), (_, diag) in panel_fitted.items():
    rec = panel_summary.query(
        "DGP == @dgp_name and `Starting model` == @start_name"
    ).iloc[0]
    print(
        f"\n=== DGP={dgp_name} | start={start_name} | "
        f"recommended={rec['Recommended']} ({rec['Match']} expected {rec['Expected']}) ==="
    )
    print(diag[["statistic", "df", "p_value"]].round(4).to_string())
=== DGP=OLS | start=OLS | recommended=OLS (yes expected OLS) ===
                          statistic  df  p_value
test                                            
Panel-LM-Lag                 0.2817   1   0.5956
Panel-LM-Error               0.0006   1   0.9811
Panel-LM-WX                  0.4026   1   0.5258
Panel-LM-SDM-Joint           0.4031   2   0.8174
Panel-LM-SLX-Error-Joint     0.4031   2   0.8174
Panel-Robust-LM-Lag          0.4026   1   0.5258
Panel-Robust-LM-Error        0.1215   1   0.7274
Panel-Robust-LM-WX           0.1215   1   0.7274

=== DGP=SAR | start=OLS | recommended=SAR (yes expected SAR) ===
                          statistic  df  p_value
test                                            
Panel-LM-Lag               124.0337   1   0.0000
Panel-LM-Error              38.8659   1   0.0000
Panel-LM-WX                 86.2147   1   0.0000
Panel-LM-SDM-Joint         125.0806   2   0.0000
Panel-LM-SLX-Error-Joint   125.0806   2   0.0000
Panel-Robust-LM-Lag         86.2147   1   0.0000
Panel-Robust-LM-Error        1.0469   1   0.3062
Panel-Robust-LM-WX           1.0469   1   0.3062

=== DGP=SEM | start=OLS | recommended=SEM (yes expected SEM) ===
                          statistic  df  p_value
test                                            
Panel-LM-Lag                13.3731   1   0.0003
Panel-LM-Error              47.4830   1   0.0000
Panel-LM-WX                  0.6353   1   0.4254
Panel-LM-SDM-Joint          48.1184   2   0.0000
Panel-LM-SLX-Error-Joint    48.1184   2   0.0000
Panel-Robust-LM-Lag          0.6353   1   0.4254
Panel-Robust-LM-Error       34.7453   1   0.0000
Panel-Robust-LM-WX          34.7453   1   0.0000

=== DGP=SLX | start=OLS | recommended=SLX (yes expected SLX) ===
                          statistic  df  p_value
test                                            
Panel-LM-Lag                76.9249   1   0.0000
Panel-LM-Error               0.1998   1   0.6549
Panel-LM-WX                141.7907   1   0.0000
Panel-LM-SDM-Joint         141.9905   2   0.0000
Panel-LM-SLX-Error-Joint   141.9905   2   0.0000
Panel-Robust-LM-Lag        141.7907   1   0.0000
Panel-Robust-LM-Error       65.0657   1   0.0000
Panel-Robust-LM-WX          65.0657   1   0.0000

=== DGP=SLX | start=SLX | recommended=SLX (yes expected SLX) ===
                            statistic  df  p_value
test                                              
Panel-LM-Lag                   0.0218   1   0.8827
Panel-LM-Error                 0.0017   1   0.9674
Panel-Robust-LM-Lag-SDM        0.0498   1   0.8234
Panel-Robust-LM-Error-SDEM     0.0297   1   0.8631

=== DGP=SDM | start=SAR | recommended=SDM (yes expected SDM) ===
                       statistic  df  p_value
test                                         
Panel-LM-Error           27.6323   1   0.0000
Panel-LM-WX              76.9247   1   0.0000
Panel-Robust-LM-WX       49.6594   1   0.0000
Panel-Robust-LM-Error     0.3669   1   0.5447

=== DGP=SDM | start=SLX | recommended=SDM (yes expected SDM) ===
                            statistic  df  p_value
test                                              
Panel-LM-Lag                  42.2132   1   0.0000
Panel-LM-Error                16.8409   1   0.0000
Panel-Robust-LM-Lag-SDM       26.2594   1   0.0000
Panel-Robust-LM-Error-SDEM     0.8871   1   0.3463

=== DGP=SDEM | start=SEM | recommended=SDEM (yes expected SDEM) ===
                     statistic  df  p_value
test                                       
Panel-LM-Lag          123.9686   1   0.0000
Panel-LM-WX           140.4812   1   0.0000
Panel-Robust-LM-Lag     5.1293   1   0.0235
Panel-Robust-LM-WX     21.6418   1   0.0000

=== DGP=SDEM | start=SLX | recommended=SDEM (yes expected SDEM) ===
                            statistic  df  p_value
test                                              
Panel-LM-Lag                  17.1584   1   0.0000
Panel-LM-Error                26.9326   1   0.0000
Panel-Robust-LM-Lag-SDM        0.7467   1   0.3875
Panel-Robust-LM-Error-SDEM    10.5209   1   0.0012

Reading the table (panel). The panel trees are the cross-sectional ones run on the Panel- tests, so the same reading applies.