Displaying 1 result from an estimated 1 matches for "nkmatrix".
2012 Sep 06
2
choose() function returning anomalous results (zero instead of one)
...;75)|(k<75)), test2 <- nChooseK(Qtwo,k),
test2 <- choose(Qtwo,k))
test1 <- choose(Qone,nn)
test2 <- choose(Qtwo,k)
#print(test1[test1==0])
ptest <- ifelse( ((partial1 == 0) | (partial2 == 0)),0,
test1*partial1*partial2*test2)
return(ptest)
}
gen_nk_old <- function (k2,Q1,Q2)
{
nkmatrix <- matrix(nrow = sum(1:k2),ncol=2)
index <- 1
for (n in 0:min(Q1, k2-1)) # This corresponds to the outer sigma for P'
{
for (k in 0:min(Q2, k2-1-n)) # This is the inner sigma for P'
{
nkmatrix[index,1] <- n
nkmatrix[index,2] <- k
index <- index + 1
}
}
return(nkmatrix[(1:(ind...