Monte Carlo hypothesis test
1 回表示 (過去 30 日間)
古いコメントを表示
Dear Matlab users, I want to do a Monte Carlo simulation of a test of a nonlinear hypothesis, my null hypothesis is beta1*beta2=1. I am using the following code:
alpha=1;
beta1=0.5;
beta2=2;
n=100;
m=10;
beta1_hat=zeros(m,1);
for i=1:m
x1=randn(n,1);
x2=randn(n,1);
e=randn(n,1);
y=alpha+beta1*x1+beta2*x2+e;
end
[h,pvalue,ci]=ttest(beta1*beta2,1)
However, when I run the code, I obtain the following: h = NaN pvalue = NaN ci = NaN NaN
I used this code for the hypothesis testing, following this: https://www.mathworks.com/help/stats/hypothesis-testing.html . Another question that I have is why do they divide by 100 price2 in the ttest?
Thanks!
2 件のコメント
Brendan Hamm
2017 年 10 月 27 日
beta1*beta2 is a scalar and so is 1 and there are not enough samples to perform any hypothesis test. Are you trying to estimate the beta coefficients from the linear equation? If this is the case, then you likely want to be using y somewhere, which you currently aren't.
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Hypothesis Tests についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!