Multivariate regression input for multivariable problem

4 Ansichten (letzte 30 Tage)
Hi everyone!
I acquired some data from images to be processed for a master thesis, and since I've decided I need to look at all the variable together, I had a look at the page on multivariate regression, but I am a bit confused as how I should input the design matrix.
Let me first explain the kind of data I have to work on: I segment images of eyeball model, that I can rotate on a stage both in the vertical (up/down) and horizontal(left/right) sense. From the images I extract a vector linking two points of interest on the eye, that I divide in the x and y component. I am interested to see the linearity of the relation between the vertical rotation and the horizontal and vertical offset and the horizontal rotation and the horizontal and vertical offset (even if ideally vertical rotations should only depend on the vertical offset etc.)
The data I have are: the vertical and horizontal rotations, which I know, and the grid I obtain rotating the eye vertically, then scanning horizontally, the rotating vertically again etc. Say, I have pictures with the eye at 5 degrees vertical rotation for horizontal degrees ranging from -30 to 30 degrees, and then I acquire again the same horizontal range but with 10 degrees vertical rotation, and so on. For each image I have two outputs (the x an y offset, that is the vectors components). so if I have a 9x9 grid, my matrix will be 9x9x2 and the vector with the known angles will be 9x2. My unknowns will be 6: 2 intercepts and 4 slopes (relative to both rotations and both offsets for each rotation).
I don't really understand how I should input these data into the mvregress command, especially the part regarding the fact that I have more than one response variable (in my case 2), that is the dimension of the response matrix Y. If this happens, it says:
If d > 1 and all d dimensions have the same design matrix, then you can specify X as a single n-by-p design matrix (not in a cell array).
If d > 1 and all n observations have the same design matrix, then you can specify X as a cell array containing a single d-by-K design matrix.
If d > 1 and all n observations do not have the same design matrix, then specify X as a cell array of length n containing d-by-K design matrices.
What does exactly means? How can I understand in which case am I? How should I input the data anyway?
Thank you all very much!

Akzeptierte Antwort

the cyclist
the cyclist am 1 Dez. 2017
My answer to this question gives a few examples of using different design matrices, depending on whether you want common slopes and/or intercepts. Take a look and see if that helps.
  2 Kommentare
Beatrice Pazzucconi
Beatrice Pazzucconi am 2 Dez. 2017
Hi,
I think I understood how I should input the data, since I want a separate regression for the horizontal rotation (alpha1) and vertical rotation (alpha2). (that would the the solution 1 in you example)
Say i acquires a data of 13x13 angles (13 on the horizontal plane and 13 on the vertical plane), so I have 169 obaservations. So my Y matrix would be a 169x2 (because I want two outputs), in which each column is the values for the alpha1 and alpha2 for each of the 169 observations (the rows). My design matrix should be a 169 cell array, in which each cell is defined as
cell{i, 1} = [1, 0, X(i, 1), 0, X(i, 2), 0;...
0, 1, X(i, 1), 0, X(i, 2)]
where X is a matrix 169x2, in which each column I have the values for the x and y offsets for each of my observations (the rows).
The only thing I did not quite understand is this: I would like eventually to write something like:
alpha1 = beta11*x_offset + beta12*y_offset + intercept1
alpha2 = beta21*x_offset + beta22*y_offset + intercept2
where beta12, beta11.... intercept1 and intercept2 are the coefficents of the weight I obtain in the b vector, the output of mvregress. How do I know which element of beta is my beta11, beta22 etc?
Thanks a bunch!
the cyclist
the cyclist am 2 Dez. 2017
If you look at the "Output Arguments" section of the documentation for mvregress, it specifies the dimensions of the beta output, for each type of design matrix entry. But it's not clear (at least to me) the exact ordering of the coefficients. If you also look up at the examples, it looks like the intercepts are always listed first (either at the top of vector output, or left-most column of matrix output).
What I will typically do to be sure I am interpreting things correctly is to put in some pretend data where I know exactly what the coefficients should be, so that I understand the output of that model.
Also, be a little bit careful in your notation compared to the MATLAB documentation. They call the intercept terms "alpha".

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by