Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

[no subject]



How about using nonlinear least-squares estimation?  The particulars below
(viz., renaming of your variables--bear with me on that) are borrowed from
one field (pharmacology) among the biological sciences, several of which
also have a basic S-shaped functional relationship among their paradigms.

Joseph Coveney

clear
set more off
input int concentration float response
1965     0
1966      .1
1967      .3
1968      .6
1969      .8
1970      .9
1971      1
end
glm
label variable concentration "Log10 Concentration (M) + 1977"
label variable response Observed
local Emax 1 // These can be estimated, too, if using
local Emin 0 // absolute values for response, instead.
nl (response = `Emin' + (`Emax' - `Emin') / ///
  (1 + ({EC50}/concentration)^{Hill})), ///
  initial(Hill 1 EC50 1968) nolog
predict response_hat, yhat
label variable response_hat Fitted
graph twoway (scatter response concentration, ///
  sort msymbol(circle) mcolor(black)) ///
  (line response_hat concentration, ///
  sort lcolor(black)), ///
  ytitle(Response (Proportion of Maximum)) ///
  ylabel(, angle(horizontal) nogrid) ///
  legend(on) legend(position(4) ring(0))
*
* Recast more familiarly:
*
replace concentration = concentration - 1977
nl (response = {Emin} + ({Emax} - {Emin}) / ///
  (1 + 10^((log10({EC50}) - concentration)*{Hill})) ), ///
  initial(Emax 1 Emin 0 Hill 1 EC50 1e-9) nolog
test _b[/Hill] = 1
estat vce, correlation // Estimating Emax & Emin overkill here
exit

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index