Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fit_IsothermalHolding(): define the models as functions rather than strings #557

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mcol
Copy link
Contributor

@mcol mcol commented Jan 28, 2025

This is necessary as the BTS model uses integrate(), and in order to retrieve its result one needs to extract $value from the object it returns. But this confuses nlsLM() into thinking that value is a parameter to be optimized and for which a starting point should be given.

The only workable solution seems to hide all that complexity into a wrapper function (f_BTS) that is used as right-hand side in the formula. Because of this, we need to reformulate also f_GOK as a function.

Due to R's abstruse way of accessing variables in the environment from inside a function, it turns out that we can access rhop but not isoT, so we have to add isoT to the model signatures and also to the data argument.

This commit also introduces some changes to the BTS model: in particular we now use sapply() inside f_BTS(), and also fix DeltaE to 1.5eV as suggested from the Li&Li paper. However, even with these changes the model doesn't fit, but reports this error:

singular gradient matrix at initial parameter estimates

This is necessary as the BTS model uses integrate(), and in order to
retrieve its result one needs to extract `$value` from the object it
returns. But this confuses nlsLM() into thinking that `value` is a
parameter to be optimized and for which a starting point should be given.

The only workable solution seems to hide all that complexity into a
wrapper function (f_BTS) that is used as right-hand side in the formula.
Because of this, we need to reformulate also f_GOK as a function.

Due to R's abstruse way of accessing variables in the environment from
inside a function, it turns out that we can access `rhop` but not `isoT`,
so we have to add `isoT` to the model signatures and also to the `data`
argument.

This commit also introduces some changes to the BTS model: in particular
we now use sapply() inside f_BTS(), and also fix DeltaE to 1.5eV. However,
even with these changes the model doesn't fit, but reports this error:

  singular gradient matrix at initial parameter estimates
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant