Displaying 4 results from an estimated 4 matches for "phob".
Did you mean:
phab
2023 Nov 06
1
non-linear regression and root finding
...ding in the formula with nls?
Sure. Just reformulate the problem in terms of a function that takes a
vector of predictors (your independent variable SID) and the desired
parameters (pK1, pK2, pK3) as separate arguments and then returns
predicted values of the dependent variable (to compare against pHobs):
kw <- 1e-14 # I'm assuming
pHm <- Vectorize(function(SID, pK1, pK2, pK3)
-log10(uniroot(HEPESFUNC,c(1e-20,1),tol=1e-20,maxiter=1e4,
HEPTOT=HEPTOT,SID = SID, pK1=pK1,pK2=pK2,pK3=pK3)$root))
(Yes, Vectorize() doesn't make the function any faster, but I don't see
an eas...
2023 Nov 06
2
non-linear regression and root finding
...with nls?
> Sure. Just reformulate the problem in terms of a function that takes a
> vector of predictors (your independent variable SID) and the desired
> parameters (pK1, pK2, pK3) as separate arguments and then returns
> predicted values of the dependent variable (to compare against pHobs):
>
> kw <- 1e-14 # I'm assuming
> pHm <- Vectorize(function(SID, pK1, pK2, pK3)
> -log10(uniroot(HEPESFUNC,c(1e-20,1),tol=1e-20,maxiter=1e4,
> HEPTOT=HEPTOT,SID = SID, pK1=pK1,pK2=pK2,pK3=pK3)$root))
>
> (Yes, Vectorize() doesn't make the function any...
2023 Nov 06
2
non-linear regression and root finding
...^-pK2*10^-pK1)+H^2/(10^-pK3*10^-pK2)+H/(10^-pK3))
??? IV <- HEPTOT/(1+XX)
??? I <- IV*H^3/(10^-pK3*10^-pK2*10^-pK1)
??? II <- IV*H^2/(10^-pK3*10^-pK2)
??? III <- IV*H/10^-pK3
??? H - kw/H + SID + I*2 + II - IV
? }
HEPTOT <- 0.050
SID <- c(-seq(10,1)*1e-4,0,seq(1,10)*1e-4)
pHobs? <- c(4.63,4.68,4.72,4.77,4.83,4.9,4.96,5.04,5.12,5.21,5.3,
??????????? 5.39,5.48,5.55,5.63,5.69,5.74,5.8,5.85,5.89,5.93)
pK1 <- -1; pK2 <- 3; pK3 <- 7.55 # literature values
pK3 <- 7.6; pK2 <- 2.96 # values eye-balled to be better
pH <- c()
for (i in 1:length(SID)) {
? pH...
2023 Nov 06
1
non-linear regression and root finding
...gt; Sure. Just reformulate the problem in terms of a function that takes a
>> vector of predictors (your independent variable SID) and the desired
>> parameters (pK1, pK2, pK3) as separate arguments and then returns
>> predicted values of the dependent variable (to compare against pHobs):
>>
>> kw <- 1e-14 # I'm assuming
>> pHm <- Vectorize(function(SID, pK1, pK2, pK3)
>> ? -log10(uniroot(HEPESFUNC,c(1e-20,1),tol=1e-20,maxiter=1e4,
>> ???????? HEPTOT=HEPTOT,SID = SID, pK1=pK1,pK2=pK2,pK3=pK3)$root))
>>
>> (Yes, Vectorize() doesn...