# [R] generating points over a function, its possible???

kjetil halvorsen kjetilh at umsanet.edu.bo
Fri Jun 21 22:32:18 CEST 2002

```what you need is rnorm, which gives N(0,1) variates, and then multiply
with the standard deviation you have estimated, sqrt(13.01403). Then

yhat <- 9.7909 + 0.035*x
ysim <- yhat + sqrt(13.01403)*rnorm(x)

Kjetil halvorsen

"Ronaldo Reis Jr." wrote:
>
> Hi,
> I have a new (for me) situation.
> I have a function for one linear model:
> y = 9.7909-0.035*x
> I have the variance of system
> var = 13.01403
> Is possible to create a random vector points of Y (simulating the real data)
> over this curve using the function and the variance? I need this to a
> discipline.
>
> I have this:
>
> | \
> |  \ -> y = 9.7909-0.035*x and var =  13.014
> |   \
> |    \
> |     \
> |      \
> |__________
>
> I need something like this (generate this points):
>
> |* \*
> | * \**
> |  **\ *
> |    *\ **
> |    * \*
> |     * \ *
> |       *\
> |____________
>
> Thanks for all
> Ronaldo
> --
> "It ain't over until it's over."
> -- Casey Stengel
> --
> |   //|\\   [*****************************][*******************]
> || ( õ õ )  [Ronaldo Reis Júnior          ][PentiumIII-600     ]
> |     V     [ESALQ/USP-Entomologia, CP-09 ][HD: 30 + 10 Gb     ]
> ||  / l \   [13418-900 Piracicaba - SP    ][RAM: 128 Mb        ]
> |  /(lin)\  [Fone: 19-429-4199 r.229      ][Video: SiS620-8Mb  ]
> ||/(linux)\ [chrysopa at insecta.ufv.br      ][Modem: Pctel-onboar]
> |/ (linux) \[ICQ#: 5692561                ][SO: CL 7.0 (2.2.19)]
> ||  ( x )   [*****************************][*******************]
> ||| _/ \_Powered by Conectiva Linux 7.0 D+:) | Lxuser#: 205366
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

```