Regress out a variable using stepwiselm?
显示 更早的评论
Hi all,
I have a table that contains M x N predictor variables and a M x 1 response variable. The first M/2 x N predictor observations come from the same subject as the remaining M/2 x N observations (i.e. if I have 100 rows, data in rows 1:50 come from subject 1:50, and data in rows 51:100 come from subject 1:50 - they are different measures of the same subject, e.g. left arm length and right arm length).
I want to build a linear model that predicts the response variable from the predictor variables, while accounting for the fact that there is a relationship (i.e. interaction) between rows 1 and 51, rows 2 and 52, rows 3 and 53 etc. I've tried adding an index column to the table -- without much success.
I'm unsure about how to add this term in stepwiselm, or whether another function might be more appropriate?
Thank you!
1 个评论
Robin
2025-3-25
Add a column "Subject" to your dataset and see if it impacts your response variable?
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Model Building and Assessment 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!