How do I obtain regression coefficients from a large data set?
Show older comments
I'm looking to obtain regression coefficients from three predictor variables (e.g. alpha1rad,alpha2rad, alpha3rad), where each variable is [101 x 20] (i.e. 101 data frames and 20 trials).
In matlab:
data =[alpha1rad(i,:);alpha2rad(i,:);alpha3rad(i,:)];
mn = mean(data,2);
dev = data-repmat(mn,1,N);
For one point in time my data was a [1 x 20] (i.e. one data frame for 20 trials) where each predictor variable (x) was:
x1 = dev (1,:); x2 = dev (2,:); x3 = dev (3,:);
before defining X as:
X = [ones(length(x1),1) x1' x2' x3'];
Therefore, how can I define X using the larger data sets (i.e.[alpha1rad(i,:);alpha2rad(i,:);alpha3rad(i,:); and would this require a for loop such as:
for i=1:101;
data = [alpha1rad(i,:);alpha2rad(i,:);alpha3rad(i,:);
end
3 Comments
Tom Lane
on 12 Nov 2012
Can you explain more about what you need? Here you appear to be getting a 20-by-4 matrix X using one row from three 20-column arrays (and defining a column of ones). When you say you want to use 101-by-20 arrays, what size do you want X to be?
Tim Bennett
on 12 Nov 2012
Tim Bennett
on 21 Nov 2012
Accepted Answer
More Answers (0)
Categories
Find more on Resizing and Reshaping Matrices 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!