Degrees or Radians for angle data?

I'm calculaing regression coefficients from three sets of angle data ([1 x 20] each) as predictor variables using the following code:
X = [ones(length(x1),1) x1' x2' x3'];
B = X\devY';
However, the coefficients obtained are completely different depending on whether I input the angle data as degrees or radians. Therefore,
1) Why does the change in units result in a large difference in the coefficients based on the same data? 2) The different coefficients mean I need to justify the units I will be using to calculate the coeffcients. Any help here would be appreciated.
Any help would be appreciated.

3 Comments

Do you also change the units of devY when you change the units of X?
Hi Walter,
the units of devY remain the same. The X predictor variables are joint angles and the Y output variables are related to the position of the foot in meters. I've will attach the code and data i'm using below.

Sign in to comment.

Answers (1)

the cyclist
the cyclist on 3 Apr 2013
Are you able to supply a small dataset that shows the problem you are talking about? As you describe it, a uniform factor (unit change) should certainly not affect the coefficients of your model.

7 Comments

First, the code i'm using to obtain the coefficients is as follows:
% X Predictor variables
[M,N] = size(data);
mn = mean(data,2);
dev = data-repmat(mn,1,N);
x1 = dev (1,:);
x2 = dev (2,:);
x3 = dev (3,:);
% Y output variables
mnY = mean(Y,2);
devY = Y-repmat(mnY,1,N);
%Coefficients
X = [ones(length(x1),1) x1' x2' x3'];
B = X\devY'
Data from Predictor Variables (PV) in degrees, where each PV is a [1 x 10] vector:
PV1: 47.2537, 44.6884, 45.8583, 48.2145, 46.0579, 48.5949, 42.096, 46.0047, 46.1201, 44.4573.
PV2: -64.8887, -67.3449, -68.645, -63.1422, -59.4189, -61.6394, -59.9642, -62.5776, -60.138, -63.1737.
PV3: 38.2869, 34.2405, 31.7914, 34.2997, 32.6586, 32.9091, 34.0009, 38.4582, 35.3904, 31.3359.
Data from Predictor Variables (PV) in radians, where each PV is a [1 x 10] vector:
PV1: 0.8269, 0.782, 0.8025, 0.8438, 0.806, 0.8504, 0.7367, 0.8051, 0.8071, 0.778.
PV2: -1.1356, -1.1785, -1.2013, -1.105, -1.0398, -1.0787, -1.0494, -1.0951, -1.0524, -1.1055.
PV3: 0.67, 0.5992, 0.5564, 0.6002, 0.5715, 0.5759, 0.595, 0.673, 0.6193, 0.5484.
Data from output variables (OV) in meters (same for both sets of angle data in different units), where each OV is a [1 x10] vector:
OV1: 0.2897, 0.298, 0.2534, 0.3007, 0.3149, 0.2797, 0.2858, 0.2789, 0.3095, 0.2438.
OV2: -0.6777, -0.667, -0.6481, -0.6729, -0.6741, -0.6449, -0.6804, -0.6513, -0.6697, -0.6617.
The coefficients [4 x 2] I've obtained from the angle data in degrees are as follows:
0, -0
0.0022, 0.0024
0.0033, -0.0012
0.0028, -0.0014
The coefficients [4 x 2] I've obtained from the angle data in radians are as follows:
0, -0
0.1246, 0.1384
0.189, -0.0711
0.1581, -0.0774
the cyclist
the cyclist on 4 Apr 2013
Edited: the cyclist on 4 Apr 2013
Your coefficients simply differ from each other by a factor of 180/pi, the conversion from radians to degrees. This is exactly as expected.
These coefficients presumably have units, just as the inputs do.
What the cyclist said. If you're solving Xb = y for b and X is in degrees and y is in meters, then b is in meters/degree. Switch X to radians and b will have to change to meters/radian as well.

Sign in to comment.

Asked:

on 3 Apr 2013

Community Treasure Hunt

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

Start Hunting!