Clustered errors in panel data in Multinomial logistic regression in python (e.g. statsmodels package) sandwich estimator

I am estimating a MNL regression model for customer choices. I have a panel data set with N = sum_{i=1}^{I} t_{text{observations}}. Since one individual makes multiple choices in my dataset. Standard errors should be adjusted for clustering. I use the statsmodels/statsmodels/discrete
/discrete_model.py MNLogit method. However, even though other methods do provide clustering robust standard errors, I cannot find how to implement it for the MNL model. I tried doing it myself by creating a sandwich estimator using this code:

Can someone please help me by if this makes sense in case of this model? If not what is the best way to do it?

Python code:

X = df[varnames].values
y = df['CHOICE'].values


X = sm.add_constant(X, prepend=False)
mnlogit_mod = sm.MNLogit(y, X)
mnlogit_fit = mnlogit_mod.fit()

#####
print("Log-likelihood for each observation:")
loglike_obs = mnlogit_fit.model.loglikeobs(mnlogit_fit.params)
print(loglike_obs)
print("Shape of log-likelihood for each observation:", loglike_obs.shape)

print("nScore/gradient vector for each variable: ndarray, (K * (J-1),)")
score = mnlogit_fit.model.score(mnlogit_fit.params)
print(score)
print("Shape of score/gradient vector:", score.shape)

print("nLoglik and score matrix:")
loglike_and_score = mnlogit_fit.model.loglike_and_score(mnlogit_fit.params)
print(loglike_and_score)
print("Shape of loglik and score matrix:", loglike_and_score[0].shape, loglike_and_score[1].shape)

print("nHessian:")
Hessian = mnlogit_fit.model.hessian(mnlogit_fit.params)
print(Hessian)
print("Shape of Hessian matrix:", Hessian.shape)

print("nJacobian:")
Jacobian = mnlogit_fit.model.score_obs(mnlogit_fit.params)
print(Jacobian)
print("Shape of Jacobian matrix:", Jacobian.shape)

print("nEstimated parameters:")
print(mnlogit_fit.params)
print("Shape of estimated parameters:", mnlogit_fit.params.shape)
###

#Here i try to adjust the standard errors

clusters = df['KEY_CUSTOMER']
cluster_ids = np.unique(clusters)
clustered_scores = np.zeros((len(cluster_ids), Jacobian.shape[1]))


for i, cluster in enumerate(cluster_ids):
    clustered_scores[i] = Jacobian[clusters == cluster].sum(axis=0)

OPG_sum = np.zeros((Jacobian.shape[1], Jacobian.shape[1]))

for score in clustered_scores:
    OPG_sum += np.outer(score, score)

H_inv = inv(Hessian)
robust_cov = H_inv @ OPG_sum @ H_inv

# Standard errors
robust_se = np.sqrt(np.diag(robust_cov))

print("Robust Standard Errors:", robust_se)

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật