Displaying 20 results from an estimated 36 matches for "theta3".
Did you mean:
theta
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 = -0.05538), data=mod14data2_random)
However, I got this error:
Error in nls(y ~ theta1 - theta2 * exp(-theta3 * x), start = list(theta1 =
0.37, :
st...
2023 Aug 20
3
Issues when trying to fit a nonlinear regression model
...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 = "data.frame")
I did the following to try to fit a nonlinear regression model:
#First, Procedure to Find Starting (initial) Values For Theta1, Theta2, and
Theta3
mymod2 <- y ~ theta1 - theta2*exp(-theta3*x)
strt2 <- c(theta1 = 1, theta2 = 2, theta3 = 3)
trysol2<-nlxb(formula=mymod2, data=mod14data2_random, start=strt2,
trace=TRUE)
trysol2
trysol2$coefficients[[3]]
#Fitting nonlinear Regression Model Using Starting Values From Previous Part
nonl...
2023 Aug 20
1
Issues when trying to fit a nonlinear regression model
...7 at gmail.com> wrote:
> 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 = -0.05538), data=mod14data2_random)
> However, I got this error:
> Error in nls(y ~ theta1 - theta2 * exp(-theta3 * x), start...
2023 Aug 20
1
Issues when trying to fit a nonlinear regression model
...t;
>> 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 = -0.05538), data=mod14data2_random)
>> However, I got this error:
>> Error in nls(y ~ theta1 - theta2 *...
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 optim. Is there another method/package that I should use for
this?
Also, I wonder if there's a more elegant way to code this equation in R;
right now my function looks something like Y/...
2023 Aug 20
1
Issues when trying to fit a nonlinear regression model
...t,
>>>
>>> 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 = -0.05538), data=mod14data2_random)
>>> However, I got this error:
>>> Error in n...
2023 Aug 20
1
Issues when trying to fit a nonlinear regression model
...t; ), x = c(16, 24, 32, 30, 30, 16, 12, 8, 36, 32, 36, 20, 26, 34,
> 28)), row.names = c(NA, -15L), class = "data.frame")
>
> I did the following to try to fit a nonlinear regression model:
>
> #First, Procedure to Find Starting (initial) Values For Theta1, Theta2, and
> Theta3
>
> mymod2 <- y ~ theta1 - theta2*exp(-theta3*x)
>
> strt2 <- c(theta1 = 1, theta2 = 2, theta3 = 3)
>
> trysol2<-nlxb(formula=mymod2, data=mod14data2_random, start=strt2,
> trace=TRUE)
> trysol2
> trysol2$coefficients[[3]]
>
> #Fitting nonlinear Regression...
2008 Apr 22
2
optimization setup
...----------------------------------------------------
function2<-function (x, theta)
{P <- function1(x, theta)
c <- P$a * x * exp(-theta[2])
d <- P$b * exp(x)
q <- theta[1] / theta[3]
res <- c + d + q; res}
# Function to be optimized
function3 <- function(theta1,theta2,theta3) {
n <- length(data)
-sum( function2(x = data[2:n], theta = c(theta1, theta2, theta3) ))}
# 'data' is my input ts class object
#--------------------------------------------------------------------------------------
Then I want to maximize function3 with respect to theta(s) (given some
s...
2011 May 23
6
Reading Data from mle into excel?
...quot;
, 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)
}
OU.lik<-function(theta1,theta2,theta3){
n<-length(X)
dt<-deltat(X)
-sum(dcOU(X[2:n],dt,X[1:(n-1)],c(theta1,theta2,theta3),log=TRUE))
}
require(stats4)
require(sde)
set.seed(1)
#X<-sde.sim(model="OU",theta=c(3,1,2),N=10000,delta=1)
mle(OU.lik,start=list(theta1=1,theta2=1,theta3=1),
method="L-BFGS-B",lower=c...
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)
fo...
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 contain:
(X,Y) # for example, SIGMA(1,1)
I would like to replace the comma with a period, e.g., SIGMA(...
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 question is: is there anyway around this?
My sec...
2012 Mar 16
2
Elegant Code
...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 <- rgamma(50,0.5,(1/b3))
sim3 <- rpois(50,theta3)
b4 <- rigamma(50,1,1)
theta4 <- rgamma(50,0.5,(1/b4))
sim4 <- rpois(50,theta4)
b5 <- rigamma(50,1,1)
theta5 <- rgamma(50,0.5,(1/b5))
sim5 <- rpois(50,theta5)
par(mfrow=c(1,5))
boxplot(sim1)
boxplot(sim2)
boxplot(sim3)
bo...
2011 May 23
0
Error in backSpline.npolySpline(sp) : spline must be monotone
...;)
> 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)
+ }
> OU.lik<-function(theta1,theta2,theta3){
+ n<-length(X)
+ dt<-deltat(X)
+ -sum(dcOU(X[2:n],dt,X[1:(n-1)],c(theta1,theta2,theta3),log=TRUE))
+ }
>
> require(stats4)
Loading required package: stats4
> require(sde)
Loading required package: sde
Loading required package: MASS
Loading required package: fda
Loading required pa...
2004 Mar 18
1
profile error on an nls object
...5 0.3894059947 -4.8975821760 0.0004141343
> hyp.res.S <- summary(hyp.res)
> hyp.res.S
Formula: log(y) ~ log(pdf.hyperb(theta, X))
Parameters:
Estimate Std. Error t value Pr(>|t|)
theta1 0.0136876 0.0359964 0.380 0.705
theta2 0.3894060 0.3079860 1.264 0.211
theta3 -4.8975822 0.2219928 -22.062 <2e-16 ***
theta4 0.0004141 0.0005457 0.759 0.451
---
Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1
Residual standard error: 0.1542 on 66 degrees of freedom
Correlation of Parameter Estimates:
theta1 theta2...
2023 Nov 07
1
non-linear regression and root finding
...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) ## only if pK1 > 0
pK2 = pK1 + exp(theta2)
pK3 = pk2 + exp(theta3)
And then use your optimiser to optimise over theta1, theta2 and theta3.
There might be better approaches depending on the specific problem.
Cheers,
Berwin
2023 Nov 07
1
non-linear regression and root finding
...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) ## only if pK1 > 0
> pK2 = pK1 + exp(theta2)
> pK3 = pk2 + exp(theta3)
>
> And then use your optimiser to optimise over theta1, theta2 and theta3.
>
> There might be better approaches depending on the specific problem.
>
> Cheers,
>
> Berwin
2018 Feb 13
0
Help with regular expressions
...PM, Dennis Fisher <fisher at plessthan.com> wrote:
> 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 contain:
> (X,Y) # for example, SIGMA(1,1)
> I would like to rep...
2018 Feb 13
1
Help with regular expressions
...than.com> wrote:
>> 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 contain:
>> (X,Y) # for example, SIGMA(1,1)
>> I w...
2017 Oct 18
4
Error messages using nonlinear regression function (nls)
...l=FALSE,data=wheat) ###
### next, try to use lm to estimate starting parameters.
wheat.list = list()
for (i in 1:length(levels(wheat$temp))){
tmpDat = wheat[wheat$temp == levels(wheat$temp)[i],]
tmp.lm <- lm(Prop ~ end,data = tmpDat)
tmp.nls <- nls(Prop ~ theta1 / (1 + exp(-(theta2 + theta3*end))),
start = list(theta1 = .5,theta2=coef(tmp.lm)[1],theta3 = coef(tmp.lm)[2]),
data = tmpDat,trace=TRUE)
tmp2.nls <- nls(Prop ~ SSlogis(end,phi1,phi2,phi3),data=tmpDat)
wheat.list[i] <- tmp.nls
}
#### End code
nlsList just returns an empty list.
When I try to loop through...