[R] R-dvel [robustness Simulation study of 2 sample test on several combination of factors ]
Jim Lemon
drjimlemon at gmail.com
Tue Apr 5 13:00:59 CEST 2016
Okay, here is a more complete example:
sample_sizes<-
matrix(c(10,10,10,25,25,25,25,50,25,100,50,25,50,100,100,25,100,100),
nrow=2)
# see what it looks like
sample_sizes
ssds<-c(4,4.4,5,6,8)
nssds<-length(ssds)
results<-list()
# first loop steps through the sample
for(ss in 1:dim(sample_sizes)[2]) {
# get the two sample sizes
ss1<-sample_sizes[1,ss]
ss2<-sample_sizes[2,ss]
then step through your SDs:
ssd_index<-1
for(ssd in ssds) {
# generate the two samples with the SDs
sample1<-rnorm(ss1,ssd)
sample2<-rnorm(ss2,ssd)
# here run your tests, recording the results that you want
results[[(ss-1)*nssds+ssd_index]]<-<your_test>
ssd_index<-ssd_index+1
}
}
The list "results" should now contain the results of whatever test you
run. Be careful to get the order right.
Jim
On Tue, Apr 5, 2016 at 8:07 PM, tan sj <sj_style_1125 at outlook.com> wrote:
> hi, Jim,
> i am not very clear about yours idea.
> How can i able to test them under the combination of factors?
> I am now trying to do three for loops....but i am stucking ....
> Please, I need help ....
> ________________________________________
More information about the R-help
mailing list