Hello R-helpers,

I want to ask your opinion since I am not so sure how to do it. This is regarding one part of my paper project and my situation is:

Stage I

I have 2 groups and for each group I need to compute the following steps;

i) Generate 3 random numbers from normal distribution and square them.
ii) Repeat step 1 for 15 times and at the end I will get 15 random numbers.

I already done stage I using for loop.

n1<-3
n2<-3
miu<-0
sd1<-1
sd2<-1
asim<-15
w<-rep(NA,asim)
x<-rep(NA,asim)
for (i in 1:asim)
{
print(i)
set.seed(i)
data1<-rnorm(n1,miu,sd1)
data2<-rnorm(n2,miu,sd2)
w[i]<-sum(data1^2)
x[i]<-sum(data2^2)
}
w
x

Second stage is;

Stage II

For each group, I need to:
i) Sort the group;
ii) Find trimmed mean for each group.


For the whole process (stage I and stage II) I need to simulate them for 5000 times. How am I going to proceed with step 2? Do you  think I need to put another loop to proceed with stage II? 

Thank you and I appreciate the time you spent to look at my problem.

Regards,
Agnes

	[[alternative HTML version deleted]]


