
Hi guys,

Im new to R and am having a bit of trouble with what should be a simple loop. It sprobably something very fundamental that im doing wrong.

 

for(i in c(1:520))
{
tmp1<- ((1-samp.pct[i])^2)*(log(1-theor.pct[i])-log(1-theor.pct[i+1]))
tmp2<- ((samp.pct[i])^2)*(log(theor.pct[i+1])-log(theor.pct[i]))
}
ADtest.stat<- (-n*(max(theor.pct))) + (n*sum(tmp1)) + (n*sum(tmp2))
names(ADtest.stat) <- c("Anderson-Darling test statistic")
print(ADtest.stat)

 

samp.pct is a vector containing 520 values between 0 and 1, so is theor.pct. n is 520. 

After running this code, tmp1 and tmp2 return only one value, where I need around 520 values. Any ideas would be appreciated.

 

Regards,

 

Andre

 
 		 	   		  
	[[alternative HTML version deleted]]

