i need to do a quadratic plateau. I saw the code and try to put my datas, but i 
had some errors. 
This is my code , 
for (mun in 1:dm[1]){  # for (mun in 8:dm[1]){    if(nu[mun]>= nmin) {          
      y1=arquivov[mun,ncv[mun]:27]      vy = as.numeric(y1)        
x=seq(1:nu[mun])
      cr=lm(vy~x+I(x^2))      ca_q[mun]=cr$coefficients[[1]]      
cl_q[mun]=cr$coefficients[[2]]      cq_q[mun]=cr$coefficients[[3]]            
alpha_q=as.numeric(ca_q[mun])      beta_q=as.numeric(cl_q[mun])      
gamma_q=as.numeric(cq_q[mun])             fm <- nls(vy ~ Mean(x, alpha, beta, 
gamma), start=list(alpha=alpha_q, beta=beta_q, gamma=gamma_q),control = 
list(maxiter = dm[1]))       fm      summary(fm)            plot(vy ~ x)      
lines(fitted(fm) ~ x)      with(as.list(coef(fm)), abline(v = -beta/(2 * 
gamma)))
    }    else{          }}
> vy [1]  77.25989  58.00000  58.00000  58.00000 109.68317  58.00000  80.00000  
> 80.00000  71.33333  69.66667  68.00000  65.33333[13]  58.00000  57.00000  
> 57.00000  57.00000  57.00000  67.00000> alpha_q[1] 67.69373> beta_q[1] 
> 1.321098> gamma_q[1] -0.1129059



Error in nls(vy ~ Mean(x, alpha, beta, gamma), start = list(alpha = alpha_q,  : 
  singular gradient
                                          
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to