An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110127/9762f8fc/attachment.pl>
Help needed
6 messages · Ben Boyadjian, Sascha Vieweg, Thomas Stewart +2 more
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
On 11-01-27 15:12, Sascha Vieweg wrote:
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)
Oh, wrong, sorry! This code belongs to your question about finding the integers!
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
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110127/7ba92b2f/attachment.pl>
On 2011-01-27 05: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. 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? 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%.
This sure looks like homework to me. You've lucked out - a couple of people have already helped you. My question is: If this is indeed homework, is your instructor ill or otherwise not available? Or why have you not sought help from your instructor? Peter Ehlers
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.
On Thu, 2011-01-27 at 09:50 -0500, Thomas Stewart wrote:
For question 2, TTT <- rt(1000,3) mean(TTT[rank(TTT) <= 975 & rank(TTT) >25])
mean(TTT, trim = 0.05) What you are doing is only removing 5% of observations in total, whilst the question asks for 5% removed off *each* end. G
On Thu, Jan 27, 2011 at 8:16 AM, Ben Boyadjian <benjy_cy_21 at hotmail.com>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.
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?
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%.
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.
[[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.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Dr. Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%