The first two are pretty basic:
#1: x <- rnorm(20)
#2: x[x<0] <- 0
#3 is poorly defined. Do you want the estimate of the mean and s.d. of
the initial (non-truncated) distribution? I think this might be doable,
but someone (preferably you) would have to try to work out the details ...
this is a statistical question, not an R coding question.
which[x<=0]
Ben Bolker
On Mon, 16 Dec 2002 Jameshutton25 at aol.com wrote:
> I would like to know how to do the following commands on R:
> 1) Choose 20 random numbers modelled on the normal distribution.
> 2)Any of these numbers that are negative to change them to ZERO.
> 3)Perform a command that will enable me to find the maximum likelihood (the
> true mean of the distribution). If any of the numbers are zero i need to
know
> which ones they were if possible.
>
> Thank you very much for your. I look forward to hearing from you.
>
> Yours Sincerely,
>
> James Hutton
>
> [[alternate HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> http://www.stat.math.ethz.ch/mailman/listinfo/r-help
>
--
318 Carr Hall bolker at zoo.ufl.edu
Zoology Department, University of Florida http://www.zoo.ufl.edu/bolker
Box 118525 (ph) 352-392-5697
Gainesville, FL 32611-8525 (fax) 352-392-3704