An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110127/836becd0/attachment.pl>
Writing program for these
4 messages · Ben Boyadjian, Ben Bolker, Siri Bjoner +1 more
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
Siterer "Sascha Vieweg" <saschaview at gmail.com>:
On 11-01-27 14:24, Ben Bolker wrote:
Ben Boyadjian <benjy_cy_21 <at> hotmail.com> writes:
Double post?
Yes, probably just hoped that if he changed the subject someone would do his homework for him...
On 11-01-27 14:24, Ben Bolker wrote:
Ben Boyadjian <benjy_cy_21 <at> hotmail.com> writes:
Double post?
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?
x <- c(1, 1.3) x==round(x, 0)
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
Rather ugly and long winded, but works: z <- rt(1000, 3) q <- quantile(z, c(.05, .95)) mean(z[z>q[1] & z<q[2]])
good luck, Ben Bolker
______________________________________________ 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