How do I obtain regression coefficients from a large data set?
Mostrar comentarios más antiguos
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 comentarios
Tom Lane
el 12 de Nov. de 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
el 12 de Nov. de 2012
Tim Bennett
el 21 de Nov. de 2012
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Resizing and Reshaping Matrices en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!