[R] Help needed

Sascha Vieweg saschaview at gmail.com
Thu Jan 27 15:12:41 CET 2011


On 11-01-27 13:16, Ben Boyadjian wrote:

> 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.

x <- c(1, 1.3)
x==round(x, 0)

> B)add elements until the first appearance of a negative element.

y <- c(1, 3, 7, -2, 3, -7)
sum(y[1:which(y<0)[1]-1])

> I know how to choose the negative elements for A but how to find integers?
> 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%.

Dono. Ideas?

> Thank yoou
>
>
> 	[[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.
>

-- 
Sascha Vieweg, saschaview at gmail.com



More information about the R-help mailing list