Giter Club home page Giter Club logo

Comments (4)

paulnorthrop avatar paulnorthrop commented on July 23, 2024

Hi Zeke,

Please could you explain what you mean? I understand the general idea of applying the itp() function to a fitted model object, but please could you explain more precisely what you would want this function to do?

Best wishes, Paul

from itp.

ZekeMarshall avatar ZekeMarshall commented on July 23, 2024

Hi Paul,

Thanks for getting back to me.

For my purposes I am fitting a polynomial model to dose-response values, see below for an example where x = the dose and y = the response.

params <- data.frame(x = c(20, 60, 90, 120, 140, 160, 180, 230, 260, 290),
y = c(1, 1, 1, 1, 0.9, 0.8, 0.7, 0.4, 0.2, 0.1))

model <- lm(data = params, y ~ poly(x, 3, raw = T))

Say I establish the category 0.75 < y <= 0.85, which is equal to "Very high response".
I need the x (dose) values which correspond to the y range (response) (0.75 < y <= 0.85), and so need to find the root of the model above for y = 0.75 and y = 0.85.

The model above is equivalent to the following equation:
y = 0.8849113353 + 0.0053553739x - 4.79279e-05x^2 + 6.83e-08*x^3

Which I could create a function for manually, for itp::itp() to evaluate. However, i'm looking to automate the fitting of a model,
then calculation of the roots of said model in order to determine categories such as the "Very high response" category detailed above.

Apologies if {itp} is not designed for this sort of task!

Many thanks,

Zeke

from itp.

paulnorthrop avatar paulnorthrop commented on July 23, 2024

You could use itp() to solve y = 0.75 and to solve y = 0.85, provided that you can set the argument interval to bracket the root. With a cubic equation you might have more than one root: two or perhaps even three. Then itp() would only find one root and you may need to think carefully about what is happening. I recall that there is a function uniroot.all() in the rootSolve package that tries to find multiple roots. Even then, I expect that you may benefit from using the information that your function is cubic. Indeed, there are specific methods for finding the roots of cubic equations That is, in this particular example, you may obtain more reliable results with code tailored to solving a cubic equation than code designed for more general cases.

Whether you use itp() or something else, I think that this case where you would write code that calls a root-finding function, rather than building this kind of feature into the root-finding function itself.

from itp.

ZekeMarshall avatar ZekeMarshall commented on July 23, 2024

Thanks for your reply and advice @paulnorthrop - much appreciated!

from itp.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.