Dear all 
I am modeling nonlinear model in lme4.  my algorithm is given below
 
NLogist<-function(x,a0,opt,tol) a0-((x-opt)^2)/(2*tol^2)
sp~NLogist(x,a0,opt,tol)
 fm.nl<-nls(sp~NLogist(Moist,a0,opt,tol),data=mydata,
        start=c(a0=0.8,opt=1,tol=3))
initexp <-   
          function(mCall, data, LHS)
          {
        xy <- data.frame(sortedXyData(mCall[["input"]], LHS, data))
    if (nrow(xy) < 3) {
        stop("too few distinct input values to fit a NLogist model")
        }
              
      pars <- as.vector(coef(glm(y ~ X+ I(X^2),family=binomial, 
                         data=xy)))
      pars<-as.vector(coef(nls(y ~  a0-((X-opt)^2)/(2*tol^2),
                    data=xy, 
                    start = list(a0 = aux[1]-(aux[2]^2)/(4*aux[3]), 
                         opt=-aux[2]/(2*aux[3]),  
                          tol = 1/sqrt(-2*aux[3])),algoritm="plinear" ))) 
 value <- c(pars[1], pars[2], pars[3])
    names(value) <- mCall[c("a0", "opt", "tol")]
   value
  }    
     SNLogist <- selfStart(~ a0-((X-opt)^2)/(2*tol^2),
  initial=initexp,parameters=   c("a0", "opt", "tol"))    
  SNLogist
 (nm2 <- nlmer(sp~ SNLogist(Moist, a0, opt, tol) ~ (a0+opt+tol)|sp.name,
             mydata, start = c(a0= -0.05, opt = 2.6, tol = 3)))
 
Now I want to date my model nm2 such that opt and tol are function of another variable say Z ( like X) i.e 
opt~Z and tol~Z  
Can anyone guide me how to update this model
Best regards 
Tahira


      
	[[alternative HTML version deleted]]


