Re: LinearRegression
- To: mathgroup at smc.vnet.net
- Subject: [mg60023] Re: LinearRegression
- From: "Frank Iannarilli" <frankeye at cox.net>
- Date: Sun, 28 Aug 2005 23:14:34 -0400 (EDT)
- References: <dehjfi$c4p$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Needs["Statistics`MultinormalDistribution`"] mu = {0, 0}; Here's your correlation coefficient r = 0.99; covar = {{1, r}, {r, 1}}; numpts=10; pts = RandomArray[MultinormalDistribution[mu, covar], numpts]; Here's your y=mx+b parameters m and b: m = 4.; b = 10; scaledpts = Map[({#[[1]], #[[2]]*m + b}) &, pts]; ListPlot[scaledpts]; The list "pts" of {x,y} points will be (on the average) centered about {0,0}, with equal spread of x values and y values. Moreover, they will exhibit the desired correlation coefficient r. The list "scaledpts" simply scales and shifts the y-values per the desired mx+b fit. Regards,