How can I employ Monte Carlo simulation?

2 ビュー (過去 30 日間)
Ulvu Mustafayev
Ulvu Mustafayev 2020 年 5 月 16 日
コメント済み: Rena Berman 2020 年 6 月 1 日
How can I write a MATLAB code that generates B = 10000 i.i.d. realizations of zT and tT for sample sizes T = 10, 20, 40, 80, 160. Set the true values to α0 ∈ {−0.8, 0.0, 0.8} and λ = 1.
  1 件のコメント
Rena Berman
Rena Berman 2020 年 6 月 1 日
(Answers Dev) Restored edit

サインインしてコメントする。

回答 (1 件)

Image Analyst
Image Analyst 2020 年 5 月 16 日
I'm not sure what "Set the true values ​​to α0 ∈ {−0.8, 0.0, 0.8} and λ = 1" means. What are the "true values" which have values of true/false or 1/0?
For what it's worth, I'm attaching some Monte Carlo simulations.
  10 件のコメント
Image Analyst
Image Analyst 2020 年 5 月 17 日
Generate a 1-by-N row vector of normally distributed random numbers. Here's a little demo.
%----------------------------------------------------------------------------
% Draw random numbers from a Guassian distribution.
N = 1000000; % Number of points.
mu = 10; % Mean
sigma = 5; % Standard deviation.
% Draw a million numbers with a mean of mu, and a standard deviation of sigma.
r = sigma * randn(1, N) + mu;
%----------------------------------------------------------------------------
% Show histogram.
histogram(r);
grid on;
fontSize = 20;
xlabel('r Value', 'FontSize', fontSize);
ylabel('Count', 'FontSize', fontSize);
% Verify what we actually got:
rMean = mean(r)
rStdDev = std(r);
caption = sprintf('Histogram. Actual Sample Mean = %f Actual Sample StDev = %f', rMean, rStdDev);
title(caption, 'FontSize', fontSize);
% Maximize figure window
g = gcf;
g.WindowState = 'maximized';
Ulvu Mustafayev
Ulvu Mustafayev 2020 年 5 月 17 日
Thanks a lot

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by