0

Currently, I fit my data with an exponential function:

Index = exp(a + b * Age + c * SaleType + d * Age * SaleType + e * miles)

But it looks like I over fit my data at the beginning, underfit at the middle and I am fine at the end. Could I use an s-shaped curved so that Y goes down slowly at the beginning of X, then steeply in the middle, then slowly at the end?

The data is the sale price of a car versus its cost. The price wont decrease a lot at the first two years of a new car, then the price drops a lot in the following 7-8 years, then the price decreases more slowly after the 10th year.

I would like to fit the non-linear logistic function:

f(x) = L/(1 + exp(-kx))

Can anyone help me with this problem? I think it can be done by R with nls(). Is it possible to fit multiple variables instead of only one x? And how do I set the initial start point?

Yanying Li
  • 11
  • 6
  • 1
    Welcome to Stack Overflow. Please see [this great post](http://stackoverflow.com/q/5963269/1152809) about how to ask an R question so that the people here can easily reproduce your environment. Basically, you want to use `dput` to export your data, and include it in your question. Also include the minimal code necessary to duplicate your issue, as well as what else you have tried. This will make your question easier to answer, so you're likely to get a response quicker. – Travis Heeter Jan 17 '17 at 17:45

1 Answers1

0

I came across with a similar problem and just published the post on that. It is not easy to fit the logistic model because of non-convexity of its cost function. You may try this curve f(x) = x/sqrt((1+x^2)). Please see this post for the solution http://rpubs.com/vodonenko/sigm_gd