[R] Fw: problem with nls....

akshay kulkarni @k@h@y_e4 @end|ng |rom hotm@||@com
Thu Mar 21 13:25:37 CET 2019


dear members,
                            On a closer inspection, I can see that the scatterplot of HF1 and HF5 is of the form y ~ -(1/x), while that of HF1 and HF6 is of the form y ~ (1/x). Is it possible that HF43nl is converging almost due to chance? I mean, for HF53nl, a straight line minimizes the RSS rather than for a curve like y ~ (1/x). Is it possible? If that is the case, should I model it linearly rather than nonlinearly? It is unsettling(this would always gives the wrong prediction given a predictor!). Or rather picewise nonlinear regression(for HF6 < 0 and HF6 > 0)?

very many thanks for your time and effort....
yours sincerely,
AKSHAY M KULKARNI


________________________________________
From: R-help <r-help-bounces using r-project.org> on behalf of akshay kulkarni <akshay_e4 using hotmail.com>
Sent: Thursday, March 21, 2019 5:26 PM
To: R help Mailing  list
Subject: [R] problem with nls....

dear members,
                            I have the following nls call:

> HF53nl <- nls(HF1 ~ ((m/HF6) + 1),data = data.frame(HF6,HF1),start = list(m = 0.1))
> overview(HF53nl)

------
Formula: HF1 ~ ((m/HF6) + 1)

Parameters:
   Estimate Std. Error t value Pr(>|t|)
m 2.147e-07  1.852e-06   0.116    0.908

Residual standard error: 0.03596 on 799 degrees of freedom

Number of iterations to convergence: 1
Achieved convergence tolerance: 1.246e-06

------
Residual sum of squares: 1.03

------
t-based confidence interval:
           2.5%        97.5%
1 -3.420983e-06 3.850292e-06

------
Correlation matrix:
  m
m 1

The scatter plot of HF6 and HF1 and the corresponding fitted line according to the above output of nls is attached(HF53nl). The fitted line is almost a straight line. But it should be a curve something of: y ~ 1/x.  I think the very small value of m is making the curve a straight line.

But the fitted curve of the following call makes sense(attached: HF43nl):

> HF43nl <- nls(HF1 ~ ((k/HF5) + 1),data = data.frame(HF5,HF1),start = list(k = 0.1))
> overview(HF43nl)

------
Formula: HF1 ~ ((k/HF5) + 1)

Parameters:
    Estimate Std. Error t value Pr(>|t|)
k -5.367e-04  5.076e-05  -10.57   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.03368 on 799 degrees of freedom

Number of iterations to convergence: 1
Achieved convergence tolerance: 3.076e-07

------
Residual sum of squares: 0.906

------
t-based confidence interval:
           2.5%         97.5%
1 -0.0006363717 -0.0004370954

------
Correlation matrix:
  k
k 1

The queer thing is that the RSS for HF53nl and HF43nl is almost the same, which points to the purported validity of HF53nl.  How is this possible? Can I go with the above estimates for the coefficient m of HF6 being equal to 2.147 * 10^(-7)? How do I make an nls call so that there is a better fit to HF1 and HF6.

NB: If you can't access the attached graphs, how do I send it to you otherwise? I can also give you HF1,HF6,HF5 if needed....

very many thanks for your time and effort....
yours sincerely,

AKSHAY M KULKARNI

-------------- next part --------------
A non-text attachment was scrubbed...
Name: HF53nl.png
Type: image/png
Size: 11024 bytes
Desc: HF53nl.png
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20190321/e0d26bbf/attachment.png>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: HF43nl.png
Type: image/png
Size: 11402 bytes
Desc: HF43nl.png
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20190321/e0d26bbf/attachment-0001.png>

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ATT00001.txt
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20190321/e0d26bbf/attachment.txt>


More information about the R-help mailing list