Dear members;
I am stuck trying to find optimal parameters using optim() function. I would be
veryy gateful if you could help me on this:
I have the following equation:
Rp,t+1 = rf+ beta*rt+1 (1)
Rp,t+1= the return of the portfolio , fr = free risk rate
Error in optim(method = BFGS, c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, :
initial value in 'vmmin' is not finite
I am running a logit model with latent class segments. I successfully got
estimates for 2 segments. However when I tried to increase the no. of
segments, I got this error message at
SnowManPaddington wiwiana at gmail.com writes:
Error in optim(method = BFGS, c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, :
initial value in 'vmmin' is not finite
I am running a logit model with latent class segments. I successfully got
estimates for 2 segments. However when I tried to
[EMAIL PROTECTED]:
p0- c(f=0.87, b=0.1, c=150)
f-p[1]; b-p[2]; c-p[3]
Do *not* redefine the meaning of the function c() to 150, or to p[3].
If you do, very few things in R will continue to work properly!
--
Karl Ove Hufthammer
__
keunhchoi at gmail.com writes:
Here is a clean version. I did this with nls and it works (see below), but
I need to do it with optim. Keun-Hyung
Great that you got it to work! Just curious if there is any reason why one
should use optim when nls works fine? If this should be on a
keunhchoi at gmail.com writes:
I saw a similar question but I still don't fully understand how to implement
optim.
vol-rep(c(0.03, 0.5, 2, 4, 8, 16, 32), 3)
time-rep(c(2,4,8),each=7)
p.mated-c(0.47, 0.48, 0.43, 0.43, 0.26, 0.23, null, 0.68, 0.62, 0.64,
0.58, 0.53, 0.47,
+ 0.24,
Here is a clean version. I did this with nls and it works (see below), but
I need to do it with optim. Keun-Hyung
# optim
vol-rep(c(0.03, 0.5, 2, 4, 8, 16, 32), 3)
time-rep(c(2,4,8),each=7)
p.mated-c(0.47, 0.48, 0.43, 0.43, 0.26, 0.23, NA, 0.68, 0.62, 0.64, 0.58,
0.53, 0.47,
0.24, 0.8, 0.79,
try:
vol - rep(c(0.03, 0.5, 2, 4, 8, 16, 32), 3)
time - rep(c(2,4,8),each=7)
p.mated - c(0.47, 0.48, 0.43, 0.43, 0.26, 0.23, NA, 0.68, 0.62, 0.64,
0.58, 0.53, 0.47, 0.24, 0.8, 0.79, 0.71, 0.56, 0.74, 0.8, 0.47)
eury - data.frame(vol=vol, time=time, p.mated=p.mated)
eury - na.omit(eury)
p0 -
I saw a similar question but I still don't fully understand how to implement
optim.
Can someone help me out with this?
Thanks. Keun-Hyung
vol-rep(c(0.03, 0.5, 2, 4, 8, 16, 32), 3)
time-rep(c(2,4,8),each=7)
p.mated-c(0.47, 0.48, 0.43, 0.43, 0.26, 0.23, null, 0.68, 0.62, 0.64,
0.58, 0.53, 0.47,
9 matches
Mail list logo