Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9208639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:39:35+00:00 2026-06-18T00:39:35+00:00

Is there a statistical difference between generating a series of paths for a montecarlo

  • 0

Is there a statistical difference between generating a series of paths for a montecarlo simulation using the following two methods (note that by path I mean a vector of 350 points, normally distributed):

A)

for path = 1:300000
    Zn(path, :) = randn(1, 350); 
end

or the far more efficient B)

Zn = randn(300000, 350);

I just want to be sure there is no funny added correlation or dependence between the rows in method B that isn’t present in method A. Like maybe method B distributes normally over 2 dimensions where A is over 1 dimension, so maybe that makes the two statistically different?

If there is a difference then I need to know the same for uniform distributions (i.e. rand instead of randn)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T00:39:36+00:00Added an answer on June 18, 2026 at 12:39 am

    Just to add to the answer of @natan (+1), run the following code:

    %# Store the seed
    Rng1 = rng;
    
    %# Get a matrix of random numbers
    X = rand(3, 3);
    
    %# Restore the seed
    rng(Rng1);
    
    %# Get a matrix of random numbers one vector at a time
    Y = nan(3, 3);
    for n = 1:3
        Y(:, n) = rand(3, 1);
    end
    
    %# Test for differences
    if any(any(X - Y ~= 0)); disp('Error'); end;
    

    You’ll note that there is no difference between X and Y. That is, there is no difference between building a matrix in one step, and building a matrix from a sequence of vectors.

    However, there is a difference between my code and yours. Note I am populating the matrix by columns, not rows, since when rand is used to construct a matrix in one step, it populates by column. By the way, I’m not sure if you realize, but as a general rule you should always try and perform vector operations on the columns of matrices, not the rows. I explained why in a response to a question on SO the other day; see here for more…

    Regarding the question of independence/dependence, one needs to be careful with the language one uses. The sequence of numbers generated by rand are perfectly dependent. For the vast majority of statistical tests, they will appear to be independent – nonetheless, in theory, one could construct a statistical test that would demonstrate the dependency between a sequence of numbers generated by rand.

    Final thought, if you have a copy of Greene’s “Econometric Analysis”, he gives a neat discussion of random number generation in section 17.2.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There is a specific and official analytics SDK for native Android apps (note that
I have lots of tables with statistical data (environment related) and wondering if there
There is a moment in my app, that I need to force to show
There is a column that exists in 2 tables. In table 1, this column
I was trying to test the performance difference between inserting into a table directly
Is there anyone using git in such a fashion? I would like to distribute
What are the differences between stored procedures and functions. Whenever there are more input,
I have a series of functions that are all designed to do the same
I am putting together a report that shows statistical information about products for a
On the front page of http://www.researchgate.net/ there are statistics that load the different users.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.