[R] error propagation

Henrique Dallazuanna wwwhsd at gmail.com
Fri Feb 8 18:35:31 CET 2008


Perhaps:

sim <- apply(x, 1, function(.x)rnorm(1000, .x[2], rnorm(1000,mean=
9.454398,sd=1.980136)))

On 08/02/2008, Steven Van Wilgenburg <slv511 at mail.usask.ca> wrote:
> Hello,
>
>
> I wish to examine the influence of error in variables on my analyses
> via error propagation. I have a data frame (x) as follows:
>
> id   response
> 1    -121
> 2    -131
> 3    -125
> etc.....
>
> I wish to propagate errors for each row in the data frame, where error
> is distributed around the value of the response variable. To do this, I
> wish to simulate 1000 variables for each row in the above data frame. I
> wrote the following, but suspect that it is not applying the function
> to each row....
>
> sim<-rnorm(1000,mean=x$response, sd= (rnorm(1000,mean= 9.454398,
> sd=1.980136)))
>
> Do I need to use tapply to have the function iteratively go through
> each row?
>
> Any advice would be appreciated.
>
>
> -Steve
>
> ______________________________________________
> R-help at r-project.org 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.
>


-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O



More information about the R-help mailing list