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 8798373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:04:58+00:00 2026-06-14T00:04:58+00:00

How to generate a sequence of numbers, which would have a specific correlation (for

  • 0

How to generate a sequence of numbers, which would have a specific correlation (for example 0.56) and would consist of.. say 50 numbers with R program?
Ty.

  • 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-14T00:04:59+00:00Added an answer on June 14, 2026 at 12:04 am

    Assuming you mean two normal/Gaussian vectors of values with correlation 0.56

    We can use mvrnorm() from package MASS

    require(MASS)
    out <- mvrnorm(50, mu = c(0,0), Sigma = matrix(c(1,0.56,0.56,1), ncol = 2),
                   empirical = TRUE)
    

    which gives

    > cor(out)
         [,1] [,2]
    [1,] 1.00 0.56
    [2,] 0.56 1.00
    

    The empirical = TRUE bit is important otherwise the actual correlation achieved is subject to randomness too and will not be exactly the stated value with larger discrepancies for smaller samples.

    Assuming you mean a lag 1 correlation of 0.56 & Gaussian random variables

    For this one you can use the arima.sim() function:

    > arima.sim(list(ar = 0.56), n = 50)
    Time Series:
    Start = 1 
    End = 50 
    Frequency = 1 
     [1]  0.62125233 -0.04742303  0.57468608 -0.07201988 -1.91416757 -1.11827563
     [7]  0.15718249  0.63217365 -1.24635896 -0.22950855 -0.79918784  0.31892842
    [13]  0.33335688 -1.24328177 -0.79056890  1.08443057  0.55553819  0.33460674
    [19] -0.33037659 -0.65244221  0.70461755  0.61450122  0.53731454  0.19563672
    [25]  1.73945110  1.27119241  0.82484460  1.58382861  1.81619212 -0.94462052
    [31] -1.36024898 -0.30964390 -0.94963216 -3.75725819 -1.77342095 -1.20963799
    [37] -1.76325350 -1.20556172 -0.94684678 -0.85407649  0.14922226 -0.31109945
    [43]  0.39456259  0.89610859 -0.70913792 -2.27954408 -1.14722464  0.39140446
    [49]  0.66376227  1.63275483
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can i generate a sequence of numbers which are in Geometric Progression in
How can I generate the sequence of numbers 1,2,5,6,9,10...... and so until 100 in
FactoryGirl.define do sequence :email do |n| user#{n}@example.com end factory :user do email {FactoryGirl.generate :email}
Suppose I have a sequence of numbers: {n, n+1, n+2, ... n + m}
I want to convert a sequence of numbers to a single number which will
I am trying to optimize a small program which calculates perfect numbers from a
How can I generate the shortest sequence with contains all possible permutations? Example: For
This is not homework. I would like to generate a random integer sequence (50
i want to generate a sequence of unique random numbers in the range of
I have some parallel Fortran90 code in which each thread needs to generate the

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.