[R] help

David Winsemius dwinsemius at comcast.net
Tue May 15 16:02:58 CEST 2012


Cutting and pasting your entire homework problem verbatim into an  
rhelp posting  and assigning it an uninformative subject line and then  
expecting a useful response is very hopeful on your part, but those  
hopes are unlikely to be realized. You might spend some time reading  
the Posting Guide and counting the number of recommendations and  
requests in it that you have apparently been ignorant of to this point  
in your academic life.

-- 
David.

On May 15, 2012, at 8:04 AM, Eva-Lotta Blom wrote:

>
>  1.  Emma is performing an experiment that requires individual  
> handling of some animals. The sizes of the animals are lognormally  
> distributed: The natural logarithms of their sizes has a normal  
> distribution with mean 3 and standard deviation 0.4. The time (in  
> minutes) it takes to handle each animal is given by
>
> 10 + s · 1.5 + eε for animals with s ≤ 20 20 + s · 0.8 + eε for  
> animals with s > 20
>
> where ε is a random variable that is normally distributed with  
> expectation 1 and variance 0.3.
>
> For a randomly picked animal, what is the (approximate) probability  
> that it can be handled in less than 30 minutes?
>
> We can solve this exercise using simulation, as follows: Simulate a  
> vector S with the sizes of 10000 animals, by using the rnorm  
> function and the “exp” function. Then, compute a vector Time of  
> length 10000 with the times it takes to handle each of these 10000  
> animals: Remember that to separate between the two cases, you can  
> use notation like for example “Time[S < 20]”. The random  
> component eε can be added by combining the “exp” function with  
> the “rnorm” function. Finally, you can find the proportion of  
> simulated values below 30. Re-do the computations a couple of times  
> to get an idea of the variability of the result.
>
> s <- c(10000)
> S <- exp(rnorm(s, 3, 0.4)) [1]# vector 10000, mean, sd
> Time <- 10+S*1.5 [1] # 10 + s · 1.5 + eε for animals with s ≤ 20
> time <- 20+S*0.8 [1] #   20 + s · 0.8 + eε for animals with s > 20
>
> can't get any further and i can't really find a good help page to  
> solve the code.
> can you help me?
> Lotta
>
> ------------------------------------------------------------------------------------
> Eva-Lotta Blom PhD student
> Dept. of BioEnv . Tjärnö
> University of Gothenburg
> 452 96 Strömstad
> Sweden
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> 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.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list