> On Apr 5, 2018, at 2:00 PM, g l <gnuli...@gmx.com> wrote: > >> Sent: Thursday, April 05, 2018 at 4:40 PM >> From: "Jeff Newmiller" <jdnew...@dcn.davis.ca.us> >> >> the coef function. >> > > For the benefit of other novices, used the following command to read the > documentation: > > ?coef > > Then tried and obtained: > >> cvalue100<-coef(graphmodelp~100) >> cvalue100 > NULL
Should have been: coef(graphmodelp) > > Then looked at the model values which of course correspond to original > non-modelled values. > > graphmodelp > 1 2 3 4 5 6 7 > 8 > 91.244636 69.457794 52.873083 40.248368 30.638107 23.322525 17.753714 > 13.514590 > 9 10 11 > 10.287658 7.831233 5.961339 Read up on ?predict and what it delivers when only a model is offered as input. > > This prompted to think that interpolation is required, but the function > 'approx' only seems to perform constant interpolation. > > Is the correct thinking to find a function to perform interpolation, then > find/write a function to differentiate the model at a specific value of x, to > find gradient at that point? Not correct. You already have `predict`. It is capale of using the `newdata` values to do interpolation with the values of the coefficients in the model. See: ?predict The original question asked for a derivative (i.e. a "gradient"), but so far it's not clear that you understand the mathematical definiton of that term. We also remain unclear whether this is homework. > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. David Winsemius Alameda, CA, USA 'Any technology distinguishable from magic is insufficiently advanced.' -Gehm's Corollary to Clarke's Third Law ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.