LinearRegression
- To: mathgroup at smc.vnet.net
- Subject: [mg59873] LinearRegression
- From: Tom De Vries <tom_toad at telus.net>
- Date: Wed, 24 Aug 2005 06:31:46 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Hello! I am trying to construct a list of "flawed" data points that would fit a linear model but have a specific Correlation Coefficient (r) My feeble attempts can produce a nice set of somewhat messed up data for a scatter plot... For example m = 0.5; b = 2.7; fudge := Random[Real, {-1, 1}]; data = Table[{i, fudge + (m i + b)}, {i, 1, 15, 1}]; ListPlot[data, PlotStyle -> {Hue[0.78]}]; If I analyze the data.... << Statistics`MultiDescriptiveStatistics` {xlist, ylist} = Transpose[data]; Correlation[xlist, ylist] I can get (r) I've never studied Statistics, so I apologize if this is a really obvious question. Can I do the reverse? Is is possible to produce a set of data that would have a given r ? The application of this is to produce sets of data as examples and questions for simple linear regression in a high school math class. Thank you for any help you can provide on this. Sincerely, Tom De Vries