I need LaTex representation of an "nls" object. Unfortunately stargazer doesn't support this object type.
Some research on the net led me to as.lm.nls function out of nls2 library. It claims to convert an nls object to corresponding lm object. In my case it failed miserably. Below is the sample output:
> DNase1 <- subset(DNase, Run == 1)
> xx <- nls(density ~ SSlogis(log(conc), Asym, xmid, scal), DNase1)
> summary(xx)
Formula: density ~ SSlogis(log(conc), Asym, xmid, scal)
Parameters:
Estimate Std. Error t value Pr(>|t|)
Asym 2.34518 0.07815 30.01 2.17e-13 ***
xmid 1.48309 0.08135 18.23 1.22e-10 ***
scal 1.04146 0.03227 32.27 8.51e-14 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.01919 on 13 degrees of freedom
Number of iterations to convergence: 0
Achieved convergence tolerance: 3.281e-06
And as.lm.nls output below doesn't match the actual output above:
> library(nls2)
Loading required package: proto
> xlm = as.lm.nls(xx)
> summary(xlm)
Call:
lm(formula = density ~ Asym + xmid + scal - 1, offset = fitted(xx))
Residuals:
Min 1Q Median 3Q Max
-0.033513 -0.012931 -0.001454 0.009699 0.038137
Coefficients:
Estimate Std. Error t value Pr(>|t|)
Asym -8.878e-07 7.815e-02 0 1
xmid -9.328e-07 8.135e-02 0 1
scal -3.751e-07 3.227e-02 0 1
Residual standard error: 0.01919 on 13 degrees of freedom
Multiple R-squared: 0.9996, Adjusted R-squared: 0.9995
F-statistic: 1.153e+04 on 3 and 13 DF, p-value: < 2.2e-16
Since nls summary output is quite similar to lm summary output, I assume that content equivalent of nls to lm object should be OK for stargazer to work its charm.
I have quite a number of nls models to be incorporated in the report, and failure of as.lm.nls has put me in bind. I need desperate help with latex output of nls object.
Any pointer about how do I proceed.
regards
K