Message-ID: <57087B00.7080002@auckland.ac.nz>
Date: 2016-04-09T03:46:08Z
From: Rolf Turner
Subject: [FORGED] Generating random data with non-linear correlation between two variables
In-Reply-To: <DB5PR07MB1109B0CC95C40D9587067A89DB910@DB5PR07MB1109.eurprd07.prod.outlook.com>
On 09/04/16 06:57, Muhammad Bilal wrote:
> Hi All,
>
> I am new to R and don't know how to achieve it.
>
> I am interested in generating a hypothetical dataframe that is consisted of say two variables named v1 and v2, based on the following constraints:
> 1. The range of v1 is 500-1500.
> 2. The mean of v1 is say 1100
> 3. The range of v2 is 300-950.
> 4. The mean of v2 is say 400
> 5. There exists a positive trend between these two variables, meaning that as v1 increases, v2 be also increase.
> 6. But the trend should be slightly non-linear. i.e., curved line.
>
> Is it possible to automatically generate through functions like rnorm.
>
> Any help will be highly appreciated.
This sounds to me very much like a homework problem. We don't do
people's homework for them on this list.
cheers,
Rolf Turner
--
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276