您如何对大数据进行假设检验?我写了以下MATLAB脚本来强调我的困惑。它所做的只是生成两个随机序列,并对另一个变量进行简单的线性回归。它使用不同的随机值多次执行此回归,并报告平均值。趋向于发生的是,随着我增加样本数量,平均p值变得很小。
我知道,由于测试的功效随样本数量的增加而增加,因此,给定足够大的样本,即使使用随机数据,p值也将变得足够小,以拒绝任何假设检验。我四处询问,有人说,“大数据”对效果大小的影响更为重要。测试是否显着并且影响足够大,我们需要关注。这是因为在大样本的p值将挑选的非常小的差异时,就像是解释在这里。
但是,效果大小可以通过缩放数据来确定。在下面,我将解释变量缩放到足够小的大小,从而在给定足够大的样本量的情况下,它对因变量产生了重大影响。
所以我想知道,如果存在这些问题,我们如何从大数据中获得任何见解?
%make average
%decide from how many values to make average
obs_inside_average = 100;
%make average counter
average_count = 1;
for average_i = 1:obs_inside_average,
%do regression loop
%number of observations
n = 1000;
%first independent variable (constant term)
x(1:10,1) = 1;
%create dependent variable and the one regressor
for i = 1:10,
y(i,1) = 100 + 100*rand();
x(i,2) = 0.1*rand();
end
%calculate coefficients
beta = (x'*x)\x'*y;
%calculate residuals
u = y - x*beta;
%calcuatate sum of squares residuals
s_2 = (n-2)\u'*u;
%calculate t-statistics
design = s_2*inv(x'*x);
%calculate standard errors
stn_err = [sqrt(design(1,1));sqrt(design(2,2))];
%calculate t-statistics
t_stat(1,1) = sqrt(design(1,1))\(beta(1,1) - 0);
t_stat(2,1) = sqrt(design(2,2))\(beta(2,1) - 0);
%calculate p-statistics
p_val(1,1) = 2*(1 - tcdf(abs(t_stat(1,1)), n-2));
p_val(2,1) = 2*(1 - tcdf(abs(t_stat(2,1)), n-2));
%save first beta to data column 1
data(average_i,1) = beta(1,1);
%save second beta to data column 2
data(average_i,2) = beta(2,1);
%save first s.e. to data column 3
data(average_i,3) = stn_err(1,1);
%save second s.e. to data column 4
data(average_i,4) = stn_err(2,1);
%save first t-stat to data column 5
data(average_i,5) = t_stat(1,1);
%save second t-stat to data column 6
data(average_i,6) = t_stat(2,1);
%save first p-val to data column 7
data(average_i,7) = p_val(1,1);
%save second p-val to data column 8
data(average_i,8) = p_val(2,1);
end
%calculate first and second beta average
b1_average = mean(data(:,1));
b2_average = mean(data(:,2));
beta = [b1_average;b2_average];
%calculate first and second s.e. average
se1_average = mean(data(:,3));
se2_average = mean(data(:,4));
stn_err = [se1_average;se2_average];
%calculate first and second t-stat average
t1_average = mean(data(:,5));
t2_average = mean(data(:,6));
t_stat = [t1_average;t2_average];
%calculate first and second p-val average
p1_average = mean(data(:,7));
p2_average = mean(data(:,8));
p_val = [p1_average;p2_average];
beta
stn_err
t_stat
p_val