Once the IF triggers in the following program, it just won't turn off:

#Get p-value from permutation distribution
N = 64
cnt = 0
for (i in 1:N){
 pdata = sample (data)
 statp=F1(size,pdata,gmean,samps)
 if (stat0 <= statp ){
          cnt=cnt+1
          print(i)
          print (statb)
           }
 }
cnt/N   
#print statements are soley for debugging purposes


#Here are the function code and test data needed to run the program:
F1=function(size,data, gmean, samps){
stat=0
start=0
end=0
for (i in 1:samps){
     end=end+size[i]
     term=mean(data[start:end])
     stat= stat +abs(term-gmean)
     start=end+1
     }
list(stat=stat)
}

samps = 4 
size = c(4,4,3,5)
data = rnorm(16, 2*rbinom(16,1, .4))
data = data +c(2,2,2,2, 0,0,0,0, 0,0,0, 0,0,0,0,0)
gmean = mean(data)
stat0=F1(size,data,gmean,samps)

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to