Displaying 1 result from an estimated 1 matches for "logpp".
Did you mean:
logfp
2011 Nov 28
1
code problem with the optim() function
...d[i,j]*pbh[j]
pahh[i]<-d[i,j]*pah[i]
sumpbh<-sum(pbhh)
sumpah<-sum(pahh)
pah[i]<-pa[i]/(1-alphanew+(alphanew*sumpbh/ssum) )
pbh[j]<-pb[j]/(1-alphanew+(alphanew*sumpah/ssum) )
# s<-sum(d[i,j]*pah[i]*pbh[j])
pp[i,j]<-(1-alphanew+(alphanew*d[i,j]/ssum ))*pah[i]*pbh[j]
logpp<-log(pp[i,j])
}
}
return(-logpp)
}
optim(c(alpha,as.vector(pa),as.vector(pb)),aickin,ratings=ratings,method="BFGS")
[[alternative HTML version deleted]]