To assess the contribution of various input factors (x, y, z) and their interactions to the response variable (A), I calculated the percentage of variance using factorial analysis in Minitab. Now I want to calculate the percentage change in A.
Say for example A is increasing when x and y are increasing and A is decreasing when z is decreasing. So how much percentage is changing in A? Is there any other software by which I can do this analysis?
Please help me in this regards.
Thanks.
I think that a simple regression would provide you what you are looking for. Since you are asking how to perform this computation for both R
and Matlab
, I'll provide you a Matlab solution since I can use it much better.
Before proceeding with a numerical example, let's review a little bit of theory:
A fitted linear regression model can be used to identify the relationship between a single predictor variable xj and the response variable y when all the other predictor variables in the model are "held fixed". Specifically, the interpretation of βj is the expected change in y for a one-unit change in xj when the other covariates are held fixed—that is, the expected value of the partial derivative of y with respect to xj.
Basically, this tells us that a one unit change in xj
generates a βj
unit change in y
. In order to obtain percent changes, the response variable y
must be converted to a logarithmic scale (ln(y)
).
Now, let's see how to perform a linear regression using the regress function in Matlab. This is as simple as:
% Response Variable
A = rand(100,1);
% Predictors
X = randi(10,100,1);
Y = rand(100,1);
Z = randi(3,100,1);
% Beta Coefficients
b = regress(A,[X Y Z]);
Now, in order to retrieve percent changes instead of unit changes, the above code must be rewritten as follows (basically, a natural log is applied to A
and percent changes are calculated multiplying the beta coefficients b
by 100
):
% Response Variable
A = rand(100,1);
A = log(A);
% Predictors
X = randi(10,100,1);
Y = rand(100,1);
Z = randi(3,100,1);
% Beta Coefficients
b = regress(A,[X Y Z]);
% Percent Changes
pc = b .* 100;
Using arbitrary vales, let's suppose that the returned betas are:
b =
0.25
-0.06
1.33
This means that: a one unit change in X
generates a +25%
change in A
, a one unit change in Y
generates a -6%
change in A
and a one unit change in Z
generates a +133%
change in A
. The interpretation of percent changes varies following the type of the predictor variables, and you must be careful about this. Given the response variable Y
and the predictor variable K
:
K
is a continuous variable, then Bk = ∂ln(Y) / ∂K
, hence a one unit change in K
generates a 100 * Bk
percent change in Y
.K
is the natural log of a continuous variable, then Bk = ∂ln(Y) / ∂ln(K)
, hence a 100%
change in K
generates a 100 * Bk
percent change in Y
.K
is a dummy variable (only two possible values: 1 = true
and 0 = false
), then the shift of K
from 0
to 1
produced a 100 * Bk
percent change in Y
.