如何使用因子分析计算百分比变化?
How to calculate percentage change using factorial analysis?
为了评估各种输入因子(x、y、z)及其交互作用对响应变量 (A) 的贡献,我使用 Minitab 中的因子分析计算了方差百分比。现在我想计算 A 的百分比变化。
例如,当 x 和 y 增加时 A 增加,当 z 减少时 A 减少。那么 A 的变化百分比是多少?
有没有其他软件可以做这个分析?
请在这方面帮助我。
谢谢。
我认为简单的回归会为您提供您正在寻找的东西。由于您询问如何对 R
和 Matlab
执行此计算,我将为您提供一个 Matlab 解决方案,因为我可以更好地使用它。
在继续进行数值示例之前,让我们回顾一下 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.
基本上,这告诉我们 xj
中一个单位的变化会在 y
中产生 βj
个单位的变化。为了获得百分比变化,必须将响应变量 y
转换为对数刻度 (ln(y)
)。
现在,让我们看看如何在 Matlab 中使用 regress function 执行线性回归。这很简单:
% 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]);
现在,为了检索百分比变化而不是单位变化,上面的代码必须重写如下(基本上,自然对数应用于 A
并计算百分比变化乘以 beta 系数 b
由 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;
使用任意值,假设返回的 beta 是:
b =
0.25
-0.06
1.33
这意味着:X
中的一个单位变化会导致 A
中的 +25%
变化,Y
中的一个单位变化会产生 -6%
A
的变化和 Z
的一个单位变化会在 A
中产生 +133%
的变化。百分比变化的解释因预测变量的类型而异,您必须注意这一点。给定响应变量 Y
和预测变量 K
:
- 如果
K
是一个连续变量,则 Bk = ∂ln(Y) / ∂K
,因此 K
中一个单位的变化会在 Y
中产生 100 * Bk
个百分比的变化。
- 如果
K
是连续变量的自然对数,则 Bk = ∂ln(Y) / ∂ln(K)
,因此 K
的 100%
变化会产生 100 * Bk
百分比变化在 Y
.
- 如果
K
是一个虚拟变量(只有两个可能的值:1 = true
和0 = false
),那么K
从0
到1
在 Y
中产生了 100 * Bk
百分比的变化。
为了评估各种输入因子(x、y、z)及其交互作用对响应变量 (A) 的贡献,我使用 Minitab 中的因子分析计算了方差百分比。现在我想计算 A 的百分比变化。
例如,当 x 和 y 增加时 A 增加,当 z 减少时 A 减少。那么 A 的变化百分比是多少? 有没有其他软件可以做这个分析?
请在这方面帮助我。
谢谢。
我认为简单的回归会为您提供您正在寻找的东西。由于您询问如何对 R
和 Matlab
执行此计算,我将为您提供一个 Matlab 解决方案,因为我可以更好地使用它。
在继续进行数值示例之前,让我们回顾一下 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.
基本上,这告诉我们 xj
中一个单位的变化会在 y
中产生 βj
个单位的变化。为了获得百分比变化,必须将响应变量 y
转换为对数刻度 (ln(y)
)。
现在,让我们看看如何在 Matlab 中使用 regress function 执行线性回归。这很简单:
% 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]);
现在,为了检索百分比变化而不是单位变化,上面的代码必须重写如下(基本上,自然对数应用于 A
并计算百分比变化乘以 beta 系数 b
由 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;
使用任意值,假设返回的 beta 是:
b =
0.25
-0.06
1.33
这意味着:X
中的一个单位变化会导致 A
中的 +25%
变化,Y
中的一个单位变化会产生 -6%
A
的变化和 Z
的一个单位变化会在 A
中产生 +133%
的变化。百分比变化的解释因预测变量的类型而异,您必须注意这一点。给定响应变量 Y
和预测变量 K
:
- 如果
K
是一个连续变量,则Bk = ∂ln(Y) / ∂K
,因此K
中一个单位的变化会在Y
中产生100 * Bk
个百分比的变化。 - 如果
K
是连续变量的自然对数,则Bk = ∂ln(Y) / ∂ln(K)
,因此K
的100%
变化会产生100 * Bk
百分比变化在Y
. - 如果
K
是一个虚拟变量(只有两个可能的值:1 = true
和0 = false
),那么K
从0
到1
在Y
中产生了100 * Bk
百分比的变化。