Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • xsmle: always report 3200 conformability error!

    Hi All,

    I conducted a regression analysis on data from over 3,000 U.S. counties, covering the period from 2016 to 2020. However, when I executed the xsmle command, I repeatedly encountered a *3200 conformability error. My five-year panel dataset comprises 15,445 observations, and the associated matrix has dimensions of 15,445 by 15,445. Furthermore, my dataset is strongly balanced. Below is the Stata code I used:

    use "$raw_data/spatial_matrix/usc_spatial_weight.dta", clear
    rename fips FIPS

    // Drop Alaska and Hawaii
    drop if state == "02" | state == "15"
    destring FIPS, replace

    // The following counties are not included in the dataset used for regression, so they are excluded from the spatial weight matrix. They are removed from both rows and columns:
    drop if inlist(FIPS, 46113, 51515, 51520, 51560, 51580, 51590, 51595, 51600, 51630, 51678, 51685, 51720, 51730, 51820, 51830, 51840, 25007, 25019, 36085, 53055)
    drop v46113 v51515 v51520 v51560 v51580 v51590 v51595 v51600 v51630 v51678 v51685 v51720 v51730 v51820 v51830 v51840 v25007 v25019 v36085 v53055

    keep v*
    save "$temp_data/weight1.dta", replace
    spatwmat using "$temp_data/weight1.dta", n(W)

    // Repeat the matrix for five years to align with the five-year panel data
    spcs2xt v*, matrix(W5) time(5)

    // This is the data used for regression
    use "$working_data/mw_county_reg_full_sample.dta", clear
    drop if Statefip == 2 | Statefip == 15
    keep if year >= 2016
    xtset FIPS year
    sort year FIPS

    spatwmat using "$temp_data/W5xt.dta", name(Wxt) standardize
    xsmle y x control, re model(sar) wmat(Wxt) type(both) nolog noeffects

    Results:
    • Weight Matrix:
      1. Imported binary weights matrix Wxt
        • Dimension: 15,445 x 15,445
    • Strongly Balanced Data:
      • xtset FIPS year
      • Panel variable: FIPS (strongly balanced)
      • Time variable: year, 2016 to 2020
      • Delta: 1 unit
    • Regression Error
    xsmle y x control, re model(sar) wmat(Wxt) type(both) nolog noeffects
    Warning: Option type(both) will be ignored
    *: 3200 conformability error
    _xsmle_est(): - function returned error
    <istmt>: - function returned error


    Any suggestions? Any help would be much appreciated.

  • #2
    I figured it out. For the regression, there is no need to expand the matrix using // Repeat the matrix for five years to align with the five-year panel data spcs2xt v*, matrix(W5) time(5), so I deleted this line and rewrote the regression as xsmle y x control, re model(sar) wmat(W) type(both) nolog noeffects. Then it worked.

    Comment

    Working...
    X