How do I obtain regression coefficients from a large data set?
Ältere Kommentare anzeigen
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 Kommentare
Tom Lane
am 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
am 12 Nov. 2012
Tim Bennett
am 21 Nov. 2012
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Resizing and Reshaping Matrices finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!