one way is:

x <- sort(rnorm(100))
y <- rnorm(100, mean = x, sd = 0.3)

plot(x, y)
abline(a = 0, b = 1)


I hope it helps.

Best,
Dimitris


mentor_ wrote:
Hi,

how can I produce random data which lies around a straight line with angle
45 degree.
Similar to this image: http://zoonek2.free.fr/UNIX/48_R/g134.png

Cheers

--
Dimitris Rizopoulos
Assistant Professor
Department of Biostatistics
Erasmus University Medical Center

Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands
Tel: +31/(0)10/7043478
Fax: +31/(0)10/7043014

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to