I have a question which requires me to write a program for simulating n = 1000 observations from the student-t distribution with 7 degrees of freedom.
I believe I have completed this part using
R <- rt(n=1000, df=7)
The second part of the question asks you to write a program for calculating the truncated mean, excluding the observations below the 5% and above the 95% of the entire random sample xi from the student-t distribution.
I have some working towards this but am unsure how to incorporate my R(1000 samples of the T distribution)
so far I have got:
pt(q=0.95, df= 7, lower.tail = FALSE) + pt(q=-0.95, df= 7, lower.tail = TRUE)
I am not sure how to plug in R, and unsure if this is even the correct method, any pointers would be really appreciated, thanks