[R] question

Mahdiyeh Erfaniyan mahdiyeh.erfaniyan at gmail.com
Mon Apr 13 20:51:30 CEST 2015


Hi all,
Recently I sent an email and I was asked to provide reproducible code of a
simple example of my situation. Instead of providing the code, I decided to
describe what I need in my code.
I've written a function V, which is a function of (r,s); so I have a
function V(r,s) in fact. The output of V is a (n-1) dimensional vector,
where n is the sample size. What I need is to calculate the following
steps *for
all possible values of (r,s)*:


1- Calculate V(r,s) for m replicates.
2- Calculate the mean of these m replicates.
3- Calculate the difference of each of m V(r,s) and the mean in step 3.
4- Calculate the absolute values of the differences in step 3.
5- Calculate the mean of the m differences calculated in step 4.

So at the end I'll have r0*s0  vectors (with dimension n-1), where r0 and
s0 are the number of possible values of r and s respectively.

My main problem is that I don't know how I should keep the replicates of
V's (produced in step 2) for calculating the differences in step 3 ,
regarding that I should consider all possible values of r and s. Some
people suggested using arrays, but some other said it could work very
slowly. I've never used arrays, so I don't know if it's a good idea or
there are better ideas as well.

Thanks for any help in advance

	[[alternative HTML version deleted]]



More information about the R-help mailing list