Hi there,

Could anyone please help me to understand what should be done in order not to get this error message: Error: evaluation nested too deeply: infinite recursion / options(expressions=)?

Here is my code:

determinant<-
function(x){det(matrix(c(1.0,0.2,0.5,0.8,0.2,1.0,0.5,0.6,0.5,0.5,0.5,1.0,x,0.8,0.6,x,1.0),ncol=4,byrow=T))}

matrix<-
function(x){(matrix(c(1.0,0.2,0.5,0.8,0.2,1.0,0.5,0.6,0.5,0.5,0.5,1.0,x,0.8,0.6,x,1.0),ncol=4,byrow=T))}


conditional<-function(x,varcov){
    varcov<-matrix(x)
    sigmaxx<-varcov[3,3]
    sigmaxz<-varcov[3,1:2]
    sigmayy<-varcov[4,4]
    sigmayz<-varcov[4,1:2]
    sigmazx<-varcov[1:2,3]
    sigmazy<-varcov[1:2,4]
    sigmazz<-varcov[1:2,1:2]
    (x-sigmaxz%*%solve(sigmaZZ)%*%sigmazy)/sqrt((sigmaxx-sigmaxz%*%solve(sigmaZZ)%*%sigmazx)*(sigmayy-sigmayz%*%solve(sigmaZZ)%*%sigmazy))}

interval<-uniroot(determinant,lower = min(c(0,1)), upper = max(c(0,1)))

I tried also with the code below, but got the same Error message.

lower.bound<-uniroot(determinant,c(0,0.5))$root
upper.bound<-uniroot(determinant,c(0.51,1))$root


Your help will be greatly appreciate!

Ana



      
	[[alternative HTML version deleted]]

