[R] gnls not optimizing values

2010-02-14 Thread Brian Doctrow
Sometimes when I try to fit a model to data using the gnls function,  
it doesn't return optimized values of the model parameters.  Instead  
it just returns the exact same values I used as initial guesses, but  
with standard errors calculated.  Example is as follows:

two_site_mHb <- gnls(y ~ (CS_AH2 + CS_AH1*10^(n1*(x-pKa1)) + CS_A_*10^ 
((n1+1)*x-n1*pKa1-pKa2)) / (1 + 10^(n1*(x-pKa1)) + 10^((n1+1)*x- 
n1*pKa1-pKa2)), start=list(CS_AH2=y[1], CS_A_=y[length(y)], CS_AH1=y 
[length(y)/2], pKa1=3.3, pKa2=5.9, n1=1.5))

and the results are:

Generalized nonlinear least squares fit
   Model: y ~ (CS_AH2 + CS_AH1 * 10^(n1 * (x - pKa1)) + CS_A_ * 10^ 
((n1 +  1) * x - n1 * pKa1 - pKa2))/(1 + 10^(n1 * (x - pKa1)) +  
10^((n1 +  1) * x - n1 * pKa1 - pKa2))
   Data: NULL
   AIC  BIC   logLik
-112.2501 -105.6390 63.12505

Coefficients:
Value Std.Errort-value  p-value
CS_AH2  8.390 0.0081958 1023.6969  0
CS_A_   8.629 0.0051456 1676.9804  0
CS_AH1  8.663 0.0085524 1012.9321  0
pKa13.300 0.0443557  74.3985   0
pKa25.900 0.4938263  11.9475   0
n1  1.500 0.22881796.5554  0

  Correlation:
CS_AH2  CS_A_  CS_AH1 pKa1  pKa2
CS_A_   -0.044
CS_AH1  -0.288  0.179
pKa10.436   0.083   0.413
pKa20.179   -0.504  -0.681  -0.295
n1  0.641   -0.095 -0.585   0.065   0.373

Standardized residuals:
Min Q1  Med Q3  
Max
-1.85468073 -0.10985684  0.05285202  0.45446735  1.81225021

Residual standard error: 0.01055068
Degrees of freedom: 19 total; 13 residual

Any thoughts as to why it's just spitting back the initial guesses,  
and how it might be avoided?  Thanks.

-Brian Doctrow
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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.


[R] gnls not optimizing values

2010-04-09 Thread Brian Doctrow
Sometimes when I try to fit a model to data using the gnls function,  
it doesn't return optimized values of the model parameters.  Instead  
it just returns the exact same values I used as initial guesses, but  
with standard errors calculated.  Example is as follows:

two_site_mHb <- gnls(y ~ (CS_AH2 + CS_AH1*10^(n1*(x-pKa1)) + CS_A_*10^ 
((n1+1)*x-n1*pKa1-pKa2)) / (1 + 10^(n1*(x-pKa1)) + 10^((n1+1)*x- 
n1*pKa1-pKa2)), start=list(CS_AH2=y[1], CS_A_=y[length(y)], CS_AH1=y 
[length(y)/2], pKa1=3.3, pKa2=5.9, n1=1.5))

and the results are:

Generalized nonlinear least squares fit
   Model: y ~ (CS_AH2 + CS_AH1 * 10^(n1 * (x - pKa1)) + CS_A_ * 10^ 
((n1 +  1) * x - n1 * pKa1 - pKa2))/(1 + 10^(n1 * (x - pKa1)) +  
10^((n1 +  1) * x - n1 * pKa1 - pKa2))
   Data: NULL
   AIC  BIC   logLik
-112.2501 -105.6390 63.12505

Coefficients:
Value Std.Errort-value  p-value
CS_AH2  8.390 0.0081958 1023.6969  0
CS_A_   8.629 0.0051456 1676.9804  0
CS_AH1  8.663 0.0085524 1012.9321  0
pKa13.300 0.0443557  74.3985   0
pKa25.900 0.4938263  11.9475   0
n1  1.500 0.22881796.5554  0

  Correlation:
CS_AH2  CS_A_  CS_AH1 pKa1  pKa2
CS_A_   -0.044
CS_AH1  -0.288  0.179
pKa10.436   0.083   0.413
pKa20.179   -0.504  -0.681  -0.295
n1  0.641   -0.095 -0.585   0.065   0.373

Standardized residuals:
Min Q1  Med Q3  
Max
-1.85468073 -0.10985684  0.05285202  0.45446735  1.81225021

Residual standard error: 0.01055068
Degrees of freedom: 19 total; 13 residual

Any thoughts as to why it's just spitting back the initial guesses,  
and how it might be avoided?  Thanks.

-Brian Doctrow
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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.