Re: [R] error propagation

From: Henrique Dallazuanna <wwwhsd_at_gmail.com>
Date: Fri, 8 Feb 2008 15:35:31 -0200

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

______________________________________________
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.
Received on Fri 08 Feb 2008 - 17:50:55 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 08 Feb 2008 - 18:30:12 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive