[R] question
Boris Steipe
boris.steipe at utoronto.ca
Mon Apr 13 21:21:57 CEST 2015
That all sounds so straightforward I wonder why you don't just code it up and try it out.
You might profit from the advice of chapter 2 of the R-Inferno for your "main problem".
If "some people" who you ask for advice think that arrays in R are intrinsically slow, you might also want to look for other people.
Cheers,
B.
(Did I mention: don't post in HTML? No. Ok. Don't post in HTML.)
On Apr 13, 2015, at 2:51 PM, Mahdiyeh Erfaniyan <mahdiyeh.erfaniyan at gmail.com> wrote:
> 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]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
More information about the R-help
mailing list