-1
d2 = Import["G:\\mauritius male  death rate(08-10).xlsx"]

{{{0.5, 0.0142}, {2.5, 0.00223}, {7., 0.00158}, {12., 0.00151}, {17., 
   0.0035}, {22., 0.0054}, {27., 0.00751}, {32., 0.01028}, {37., 
   0.01604}, {42., 0.02347}, {47., 0.03576}, {52., 0.05677}, {57., 
   0.07494}, {62., 0.11366}, {67., 0.16382}, {72., 0.23114}, {77., 
   0.32861}, {82., 0.44569}, {85., 0.99999}}}

d = d[[1]]

Recursion depth of 1024 exceeded.<<

Am trying to fit this data in

nlm = NonlinearModelFit[d, b Exp[m x]/(1 + b Exp[m x]), {b, m}, x] // Normal
m_goldberg
  • 107,779
  • 16
  • 103
  • 257
akshay0808
  • 11
  • 2

1 Answers1

4

So, I think this is what you actually wanted:

d2 = {{{0.5, 0.0142}, {2.5, 0.00223}, {7., 0.00158}, {12., 
     0.00151}, {17., 0.0035}, {22., 0.0054}, {27., 0.00751}, {32., 
     0.01028}, {37., 0.01604}, {42., 0.02347}, {47., 0.03576}, {52., 
     0.05677}, {57., 0.07494}, {62., 0.11366}, {67., 0.16382}, {72., 
     0.23114}, {77., 0.32861}, {82., 0.44569}, {85., 0.99999}}};
d = d2[[1]];

logf = LogitModelFit[d, x, x]

Show[Plot[logf[x], {x, 0, 125}, PlotRange -> All], 
 ListPlot[d, PlotRange -> All]]

1/(1+Exp[8.81571 - 0.111638 x]

enter image description here

You can also add weighting to your data.

d1 = {0.1, 0.1, 0.1, 0.1, 0.2, 0.2, 0.2, 0.2, 0.3, 0.3, 
0.3, 0.4, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0};
logfw = LogitModelFit[d, x, x, ConfidenceLevel -> 0.9, Weights -> d1]

Your original equation yields the following (when the initial conditions are set):

nlm = NonlinearModelFit[d, a Exp[b x] /(1 + a Exp[b x]), {{a, 0.001}, {b, 0.001}}, x]

2.88946*10^-7 Exp[0.190243 x] / 1 + 2.88946*10^-7 Exp[0.190243 x]

enter image description here

Young
  • 7,495
  • 1
  • 20
  • 45