Skip to content

LMF reports the same predictions for newdata #1481

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
shengzhuo-yuan opened this issue Jan 25, 2025 · 2 comments
Open

LMF reports the same predictions for newdata #1481

shengzhuo-yuan opened this issue Jan 25, 2025 · 2 comments

Comments

@shengzhuo-yuan
Copy link

When I use the LMF to predict the slopes hk(x) for new data, the prediction is the same for all samples, which should differ for different x.

@shengzhuo-yuan
Copy link
Author

#train linear model forest
lmf <- lm_forest(iv_x.s16, sch_exp.s16, iv_w.s16)
#prediction for section 16
tau.hat.s16 <- predict(lmf)$predictions
#make it 2D instead of 3D
tau.hat.s16 <- drop(tau.hat.s16)
#prediction for non section 16
tau.hat.ns16 <- predict(lmf, newdata=iv_x.ns16)$predictions
tau.hat.ns16 <- drop(tau.hat.ns16)

The predictions for non section 16 are the same for all observations though they have different x

@erikcs
Copy link
Member

erikcs commented May 5, 2025

Hi @shengzhuo-yuan, if, for example, your trained lm forest did not split on any covariates, the predictions will all be the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants