search for: vbar2

Displaying 3 results from an estimated 3 matches for "vbar2".

Did you mean: var2
2010 Aug 17
1
replace loops with matrix
...matrix form?computation, it 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 (h...
2010 Sep 15
1
optim with BFGS--what may lead to this, a strange thing happened
...erence in par[54] report. but when I add it, very soon it will give the upper result. what may lead to this and how to fix it? thanks for any suggestion in advance. Nan from Montreal # the main function mymatrix<-function(par,data) { # define the parameter matrix used in following part vbar2<-matrix(0,n,nt) vbar3<-matrix(0,n,nt) v8 <-matrix(0,n,nt) regw<-matrix(0,n,nt) wden<-matrix(0,n,nt) lia<-matrix(0,n,nt) ccl<-matrix(1,n,ns) eta<-c(0,0) # setup the parts for loglikelihood q1<-exp(par[1]) pr1<-q1/(1+q1) pr2<-1-pr1 eta[2]<-par[2] a<-par[3:6]...
2010 Sep 07
5
question on "optim"
...ions is: what reason lead to the first?equation does not work and the way to correct it to make it work? ?I wish I made the queston clear and thanks for any suggestion. Nan from Montreal #the function myfunc1<-function(par,data) { # define the parameter matrix used in following part vbar2<-matrix(0,n,nt) vbar3<-matrix(0,n,nt) v8 <-matrix(0,n,nt) regw<-matrix(0,n,nt) wden<-matrix(0,n,nt) lia<-matrix(0,n,nt) ccl<-matrix(1,n,ns) eta<-c(0,0) # setup the parts for loglikelihood q1<-exp(par[1]) pr1<-q1/(1+q1) pr2<-1-pr1 eta[2]<-par[2] a<-par[3:6] b...