for each i=1,2,3 - could use a loop - but have big matrices and efficiency is important

Code:

`A=matrix(1:9,ncol=3)`

B=matrix(11:19,ncol=3)

out=rep(0,3)

for (i in 1:3)

{

out[i] = crossprod(A[i,],B[i,])

}

I have two questions regarding running for loop

1) How to tidy up the output

2) Speeding up the time taken to execute

Code:

`install.packages("kappaSize")`

require(kappaSize)

p<-c(seq(0.81,0.99,0.05))

q<-c(0.7,0.8,0.9)

# Start counting time

ptm <- proc.time()

p<-c(seq(0.81,0.99,0.05))

q<-c(0.7,0.8,0.9)

for(i in 1:length(p)){

for(j in 1:length(q)){

out<-CIBinary(p[i], 0.8, kappaU=NA, props=q[j], raters=2, alpha=0.05)

k<-cbind(k0=out[1], props=out[4],sample=out[8])

print(k)

}

}

# End Clock

proc.time() - ptm

Code:

` k0 props sample`

kappa0 0.81 0.7 11577

k0 props sample

kappa0 0.81 0.8 15157

k0 props sample

kappa0 0.81 0.9 26852

k0 props sample

kappa0 0.86 0.7 322

k0 props sample

kappa0 0.86 0.8 422

k0 props sample

kappa0 0.86 0.9 746

k0 props sample

kappa0 0.91 0.7 96

k0 props sample

kappa0 0.91 0.8 126

k0 props sample

kappa0 0.91 0.9 222

k0 props sample

kappa0 0.96 0.7 46

k0 props sample

kappa0 0.96 0.8 60

k0 props sample

kappa0 0.96 0.9 105

Code:

`> proc.time() - ptm`

user system elapsed

3.70 0.04 3.76

1) Is there a faster way or running it?

2) Is there a nice way of making the output tidier i.e. the header is outputted only once? possibly using some wrapper functions?

Thnx ]]>

For now I included categorical variabels with at least one significant level for the multivariate analysis (I include the whole variabel, not only the significant levels as seperate variabels).

However, I read "A good analysis will report an overall P value for a categorical risk factor from a so-called multiple degree of freedom test. This P value is a test of the hypothesis that all the responses are equal against the alternative that the response in at least one category is different from the others. This test, which should always be reported, is not affected by the choice of the baseline category."

R does not report the overall p-value of categorical variabels after regression! How to get the overall p- value of the categorical in r?

Tnx ]]>