Displaying 20 results from an estimated 900 matches similar to: "Problem with MLE"
2011 May 23
0
Error in backSpline.npolySpline(sp) : spline must be monotone
I get the following error:
Error in backSpline.npolySpline(sp) : spline must be monotone
Has anyone had this error before? any ideas on a workaround?
>
> vols=read.csv(file="C:/Documents and Settings/Hugh/My
> Documents/PhD/Swaption vols.csv"
+ , header=TRUE, sep=",")
> X<-ts(vols[,2])
> #X
>
>
> dcOU<-function(x,t,x0,theta,log=FALSE){
+
2011 May 23
6
Reading Data from mle into excel?
Hi there,
I ran the following code:
vols=read.csv(file="C:/Documents and Settings/Hugh/My Documents/PhD/Swaption
vols.csv"
, header=TRUE, sep=",")
X<-ts(vols[,2])
#X
dcOU<-function(x,t,x0,theta,log=FALSE){
Ex<-theta[1]/theta[2]+(x0-theta[1]/theta[2])*exp(-theta[2]*t)
Vx<-theta[3]^2*(1-exp(-2*theta[2]*t))/(2*theta[2])
dnorm(x,mean=Ex,sd=sqrt(Vx),log=log)
}
2023 Aug 20
1
Issues when trying to fit a nonlinear regression model
Oh, sorry; I changed signs in the model, fitting
theta0 + theta1*exp(theta2*x)
So for theta0 - theta1*exp(-theta2*x) use theta1= -.exp(-1.8) and theta2 =
+.055 as starting values.
-- Bert
On Sun, Aug 20, 2023 at 11:50?AM Paul Bernal <paulbernal07 at gmail.com> wrote:
> Dear Bert,
>
> Thank you so much for your kind and valuable feedback. I tried finding the
> starting
2023 Aug 20
1
Issues when trying to fit a nonlinear regression model
Dear Bert,
Thank you for your extremely valuable feedback. Now, I just want to
understand why the signs for those starting values, given the following:
> #Fiting intermediate model to get starting values
> intermediatemod <- lm(log(y - .37) ~ x, data=mod14data2_random)
> summary(intermediatemod)
Call:
lm(formula = log(y - 0.37) ~ x, data = mod14data2_random)
Residuals:
Min
2023 Aug 20
1
Issues when trying to fit a nonlinear regression model
Basic algebra and exponentials/logs. I leave those details to you or
another HelpeR.
-- Bert
On Sun, Aug 20, 2023 at 12:17?PM Paul Bernal <paulbernal07 at gmail.com> wrote:
> Dear Bert,
>
> Thank you for your extremely valuable feedback. Now, I just want to
> understand why the signs for those starting values, given the following:
> > #Fiting intermediate model to get
2023 Aug 20
2
Issues when trying to fit a nonlinear regression model
Dear Bert,
Thank you so much for your kind and valuable feedback. I tried finding the
starting values using the approach you mentioned, then did the following to
fit the nonlinear regression model:
nlregmod2 <- nls(y ~ theta1 - theta2*exp(-theta3*x),
start =
list(theta1 = 0.37,
theta2 = exp(-1.8),
theta3 =
2023 Aug 20
1
Issues when trying to fit a nonlinear regression model
I got starting values as follows:
Noting that the minimum data value is .38, I fit the linear model log(y -
.37) ~ x to get intercept = -1.8 and slope = -.055. So I used .37,
exp(-1.8) and -.055 as the starting values for theta0, theta1, and theta2
in the nonlinear model. This converged without problems.
Cheers,
Bert
On Sun, Aug 20, 2023 at 10:15?AM Paul Bernal <paulbernal07 at
2023 Aug 20
3
Issues when trying to fit a nonlinear regression model
Dear friends,
This is the dataset I am currently working with:
>dput(mod14data2_random)
structure(list(index = c(14L, 27L, 37L, 33L, 34L, 16L, 7L, 1L,
39L, 36L, 40L, 19L, 28L, 38L, 32L), y = c(0.44, 0.4, 0.4, 0.4,
0.4, 0.43, 0.46, 0.49, 0.41, 0.41, 0.38, 0.42, 0.41, 0.4, 0.4
), x = c(16, 24, 32, 30, 30, 16, 12, 8, 36, 32, 36, 20, 26, 34,
28)), row.names = c(NA, -15L), class =
2009 Oct 27
1
Poisson dpois value is too small for double precision thus corrupts loglikelihood
Hi - I have a likelihood function that involves sums of two possions:
L = a*dpois(Xi,theta1)*dpois(Yi,theta2)+b*(1-c)*a*dpois(Xi,theta1+theta3)*dpois(Yi,theta2)
where a,b,c,theta1,theta2,theta3 are parameters to be estimated.
(Xi,Yi) are observations. However, Xi and Yi are usually big (>
20000). This causes dpois to returns 0 depending on values of theta1,
theta2 and theta3.
My first
2008 Apr 22
2
optimization setup
Hi, here comes my problem, say I have the following functions (example case)
#------------------------------------------------------------
function1 <- function (x, theta)
{a <- theta[1] ( 1 - exp(-theta[2]) ) * theta[3] )
b <- x * theta[1] / theta[3]^2
return( list( a = a, b = b )) }
#-----------------------------------------------------------
function2<-function (x, theta)
{P
2011 Jul 09
3
Confusing piece of R code
m0<-epxression((4*theta1*theta2-theta3^2)/(2*x*theta3^2)-0.5*theta1*x)
params<-all.vars(m0) this reads all the params
from m0 so theta1,2 and 3 correct?
params<-params[-which(params=="x")] checks which params are multiplied
by x?
np<-length(params)
for(i in 1:6){
esp<-get(sprintf("m%d",i-1))
2004 May 15
2
questions about optim
Hi,
I am trying to do parameter estimation with optim, but I can't get it to
work quite right-- I have an equation X = Y where X is a gaussian, Y is a
multinomial distribution, and I am trying to estimate the probabilities of
Y( the mean and sd of X are known ), Theta1, Theta2, Theta3, and Theta4; I
do not know how I can specify the constraint that Theta1 + Theta2 + Theta3 +
Theta4 = 1 in
2023 Nov 07
1
non-linear regression and root finding
Thanks a lot, Berwin. Unfortunately, pK1 may well be negative and as I
understand the literature it may be poorly defined as such, and also
seems to be at a boundary, since when lower is set to say rep(-4,3) pK1
is returned as -4 while pK2 and pK3 are undisturbed. Perhaps the point
is that pK1 is not carrying any information at the pH around 5. Fair
enough, I guess. Only, I believe I need
2012 Mar 16
2
Elegant Code
Hi,
Can anyone help to write a more elegant version of my code? I am sure
this can be put into a loop but I am having trouble creating the
objects b1,b2,b3,...,etc.
b1 <- rigamma(50,1,1)
theta1 <- rgamma(50,0.5,(1/b1))
sim1 <- rpois(50,theta1)
b2 <- rigamma(50,1,1)
theta2 <- rgamma(50,0.5,(1/b2))
sim2 <- rpois(50,theta2)
b3 <- rigamma(50,1,1)
theta3 <-
2023 Nov 07
1
non-linear regression and root finding
G'day Troels,
On Mon, 6 Nov 2023 20:43:10 +0100
Troels Ring <tring at gvdnet.dk> wrote:
> Thanks a lot! This was amazing. I'm not sure I see how the conditiion
> pK1 < pK2 < pK3 is enforced?
One way of enforcing such constraints (well, in finite computer
arithemtic only "<=" can be enforced) is to rewrite the parameters as:
pK1 = exp(theta1) ##
2018 Feb 13
3
Help with regular expressions
R 3.4.2
OS X
Colleagues
I would appreciate some help with regular expressions.
I have string that looks like:
" ITERATION ,THETA1 ,THETA2 ,THETA3 ,THETA4 ,THETA5 ,THETA6 ,THETA7 ,SIGMA(1,1) ,SIGMA(2,1) ,SIGMA(2,2)?
In the entries that
2004 Mar 18
1
profile error on an nls object
Hello all,
This is the error message that I get.
> hyp.res <- nls(log(y)~log(pdf.hyperb(theta,X)), data=dataModel,
+ start=list(theta=thetaE0),
+ trace=TRUE)
45.54325 : 0.1000000 1.3862944 -4.5577142 0.0005503
3.728302 : 0.0583857346 0.4757772859 -4.9156128701 0.0005563154
1.584317 : 0.0194149477 0.3444648833 -4.9365149150 0.0004105426
1.569333 :
2018 Feb 13
0
Help with regular expressions
Hi Dennis,
How about:
# define the two values to search for
x<-2
y<-3
# create your search string and replacement string
repstring<-paste(x,y,sep=",")
newstring<-paste(x,y,sep=".")
# this is the string that you want to change
thetastring<-"SIGMA(2,3)"
sub(repstring,newstring,thetastring)
[1] "SIGMA(2.3)"
Use gsub if you want to change
2003 Feb 22
2
4-parameter logistic model
Dear R users
I'm a new user of R and I have a basic question about the 4-parameter
logistic model. According to the information from Pinheiro & Bates the model
is:
y(x)=theta1+(theta2-theta1)/(1+exp((theta3-x)/theta4)) ==
y(x)=A+(B-A)/(1+exp((xmid-input)/scal))
from the graph in page 518 of the book of the same authors (mixed models in
S) theta 1 corresponds to the horizontal asymptote
2017 Oct 18
4
Error messages using nonlinear regression function (nls)
Hi all,
I am trying to use nonlinear regression (nls) to analyze some seed germination data, but am having problems with error codes.
The data that I have closely matches the germination dataset included in the drc package.
Here is the head of the data
temp species start end germinated TotSeeds TotGerminated Prop
1 10 wheat 0 1 0 20 0 0.0
2 10 wheat