Regress out a variable using stepwiselm?
Show older comments
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 Comment
Robin
on 25 Mar 2025
Add a column "Subject" to your dataset and see if it impacts your response variable?
Accepted Answer
More Answers (0)
Categories
Find more on Model Building and Assessment in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!