[R] Writing program for these

Ben Bolker bbolker at gmail.com
Thu Jan 27 15:24:34 CET 2011


Ben Boyadjian <benjy_cy_21 <at> hotmail.com> writes:

> 
> Hello I am trying to solve these problems and I am not allowed to use loops or
ifs.
> 
> 1st Question
> My first question is that I have generated 100 random numbers from the uniform
distribution then 
> A)add only the negative integers. 
> B)add elements until the first appearance of a negative element. 
> 
> I know how to choose the negative elements for A but how to find integers? 

  If this is the standard uniform U(0,1) distribution (which I assume
from your phrase "*the* uniform distribution" (emphasis added))
then there will be no integers in the sample ... ??

> And I dont know what to do for B.
> 
> 2nd Question
>  Simulate 1000 observations from the student-t distribution with 3 degrees of
freedom and then calculate
> the truncated mean by excluding bottom 5% and top 5%.

  Looks like homework questions, which are not answered on this list.
Please read the posting guide; if these are *not* homework questions,
please give us a plausible context.  (Even if these are not homework
questions, the posting guide asks that you "do your homework" in a
broader sense by indicating what steps you have taken to solve your
problem on your own before posting.)

 One hint for the second question: ?rt

  good luck,
    Ben Bolker



More information about the R-help mailing list