R nonlinear regression of cumulative X and Y data












0















I'm trying to figure how to make a nonlinear regression of some cumulative data of X and Y values. The dataset is based on cumulative items and their respective cumulated demand. I have a plot that looks like this



cumulative demand of cumulative items



based on the following observation of 5299 items, which is available here: abc.csv datafile



and I would like to fit a model that can explain it quite neatly. Given the plot, I reckon that there is a high degree of detail. Hence, I would believe that it would be possible to find a function that would explain the data with very high accuracy.



The problem is, however, that I find myself trying to fit a model with nls() by trial and error. Furthermore, some of the functions that I've tried give me some explanation, but not in full detail. For instance




nlm <- nls(abc$Cumfreq ~c*(1-exp(-a*abc$noe))+b, data=abc,
start = list(a=4.14, b=0.21, c=0.79))




Yields me:



With regression



My question is: how do I obtain a regression with a better fit? Is there a function in R or another way of achieving this? (fingers crossed for a math genius out there)










share|improve this question

























  • What is the goal? Prediction or inference?

    – Roland
    Nov 21 '18 at 5:55











  • Sorry for the delay. I guess the goal is prediction.

    – LRO
    Dec 3 '18 at 22:07











  • Then I would fit a GAM. Don't forget to validate/crossvalidate.

    – Roland
    Dec 4 '18 at 7:04
















0















I'm trying to figure how to make a nonlinear regression of some cumulative data of X and Y values. The dataset is based on cumulative items and their respective cumulated demand. I have a plot that looks like this



cumulative demand of cumulative items



based on the following observation of 5299 items, which is available here: abc.csv datafile



and I would like to fit a model that can explain it quite neatly. Given the plot, I reckon that there is a high degree of detail. Hence, I would believe that it would be possible to find a function that would explain the data with very high accuracy.



The problem is, however, that I find myself trying to fit a model with nls() by trial and error. Furthermore, some of the functions that I've tried give me some explanation, but not in full detail. For instance




nlm <- nls(abc$Cumfreq ~c*(1-exp(-a*abc$noe))+b, data=abc,
start = list(a=4.14, b=0.21, c=0.79))




Yields me:



With regression



My question is: how do I obtain a regression with a better fit? Is there a function in R or another way of achieving this? (fingers crossed for a math genius out there)










share|improve this question

























  • What is the goal? Prediction or inference?

    – Roland
    Nov 21 '18 at 5:55











  • Sorry for the delay. I guess the goal is prediction.

    – LRO
    Dec 3 '18 at 22:07











  • Then I would fit a GAM. Don't forget to validate/crossvalidate.

    – Roland
    Dec 4 '18 at 7:04














0












0








0








I'm trying to figure how to make a nonlinear regression of some cumulative data of X and Y values. The dataset is based on cumulative items and their respective cumulated demand. I have a plot that looks like this



cumulative demand of cumulative items



based on the following observation of 5299 items, which is available here: abc.csv datafile



and I would like to fit a model that can explain it quite neatly. Given the plot, I reckon that there is a high degree of detail. Hence, I would believe that it would be possible to find a function that would explain the data with very high accuracy.



The problem is, however, that I find myself trying to fit a model with nls() by trial and error. Furthermore, some of the functions that I've tried give me some explanation, but not in full detail. For instance




nlm <- nls(abc$Cumfreq ~c*(1-exp(-a*abc$noe))+b, data=abc,
start = list(a=4.14, b=0.21, c=0.79))




Yields me:



With regression



My question is: how do I obtain a regression with a better fit? Is there a function in R or another way of achieving this? (fingers crossed for a math genius out there)










share|improve this question
















I'm trying to figure how to make a nonlinear regression of some cumulative data of X and Y values. The dataset is based on cumulative items and their respective cumulated demand. I have a plot that looks like this



cumulative demand of cumulative items



based on the following observation of 5299 items, which is available here: abc.csv datafile



and I would like to fit a model that can explain it quite neatly. Given the plot, I reckon that there is a high degree of detail. Hence, I would believe that it would be possible to find a function that would explain the data with very high accuracy.



The problem is, however, that I find myself trying to fit a model with nls() by trial and error. Furthermore, some of the functions that I've tried give me some explanation, but not in full detail. For instance




nlm <- nls(abc$Cumfreq ~c*(1-exp(-a*abc$noe))+b, data=abc,
start = list(a=4.14, b=0.21, c=0.79))




Yields me:



With regression



My question is: how do I obtain a regression with a better fit? Is there a function in R or another way of achieving this? (fingers crossed for a math genius out there)







r nls non-linear-regression nonlinear-functions cumulative-frequency






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 20 '18 at 23:27









neilfws

18.2k53749




18.2k53749










asked Nov 20 '18 at 23:25









LROLRO

82




82













  • What is the goal? Prediction or inference?

    – Roland
    Nov 21 '18 at 5:55











  • Sorry for the delay. I guess the goal is prediction.

    – LRO
    Dec 3 '18 at 22:07











  • Then I would fit a GAM. Don't forget to validate/crossvalidate.

    – Roland
    Dec 4 '18 at 7:04



















  • What is the goal? Prediction or inference?

    – Roland
    Nov 21 '18 at 5:55











  • Sorry for the delay. I guess the goal is prediction.

    – LRO
    Dec 3 '18 at 22:07











  • Then I would fit a GAM. Don't forget to validate/crossvalidate.

    – Roland
    Dec 4 '18 at 7:04

















What is the goal? Prediction or inference?

– Roland
Nov 21 '18 at 5:55





What is the goal? Prediction or inference?

– Roland
Nov 21 '18 at 5:55













Sorry for the delay. I guess the goal is prediction.

– LRO
Dec 3 '18 at 22:07





Sorry for the delay. I guess the goal is prediction.

– LRO
Dec 3 '18 at 22:07













Then I would fit a GAM. Don't forget to validate/crossvalidate.

– Roland
Dec 4 '18 at 7:04





Then I would fit a GAM. Don't forget to validate/crossvalidate.

– Roland
Dec 4 '18 at 7:04












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53403138%2fr-nonlinear-regression-of-cumulative-x-and-y-data%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53403138%2fr-nonlinear-regression-of-cumulative-x-and-y-data%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Xamarin.form Move up view when keyboard appear

Post-Redirect-Get with Spring WebFlux and Thymeleaf

Anylogic : not able to use stopDelay()