# how to fit a generalized nonlinear model in R?

I've been trying to find a way to fit a generalized nonlinear model in R, with little success. The stochastic component would be the following:

$$Y \sim binomial(n, pi)$$

The parameters being b1 and $\gamma$

The systematic component is the following:

$$pi = \frac{e^{b1*(conc - \gamma)}}{1+e^{b1*(conc - \gamma)}}$$

In SAS this model can be fit using the following code:

data one;
do j=1 to 6;
input conc n y @@; conc=conc/10;
output;
end; datalines;
501 48 48 407 50 47 302 49 47 204 48 34 100 48 18 51 49 16
;

proc nlmixed data=one;
parms b1=1 gam=10;
ex=exp(b1*(conc-gam));
pi=ex/(1+ex);
model y~binomial(n,pi);
run;


Any ideas on how to fit this in R?

• The package gnm is explicitly for generalized nonlinear models – Glen_b Sep 24 '15 at 18:07
• @Ian have you looked at the locfit package with implements local (i.e., nonlinear, nonparametric) GLM? – Antoine Sep 24 '15 at 18:53