search for: acedu

Displaying 1 result from an estimated 1 matches for "acedu".

Did you mean: acedo
2010 Aug 17
1
replace loops with matrix
...takes only 1/10 of the time the loop method takes. it may still have room to improve it. at least, the?following part?looks ugly. ccl[,m]<-lia[,1]*lia[,2]*lia[,3]*lia[,4]*lia[,5] any suggestion are appreciated. The Loop code: for(m in 1:ns){ ?for(i in 1:nt){ ??? vbar2[,i]=a[1]+???? eta[m]+acedu[,i]*a[2]+acwrk[,i]*a[3] ??? vbar3[,i]=b[1]+b[2]*eta[m]+acedu[,i]*b[3]+acwrk[,i]*b[4] ??? v8[,i]=1+exp(vbar2[,i])+exp(vbar3[,i]) ????? for(j in 1:n){ ?? ???? ? if (edu[j,i]==1) lia[j,i]=1/v8[j,i] ????????? if (wrk[j,i]==1) lia[j,i]=exp(vbar2[j,i])/v8[j,i] ????????? if (home[j,i]==1) lia[j,i]=exp(v...