[R] R: optim

Clark Allan Allan at STATS.uct.ac.za
Tue Sep 6 12:53:46 CEST 2005


hi all

i dont understand the error message that is produced by the optim
function. can anybody help???

ie: 
[[1]]$message
[1] "CONVERGENCE: REL_REDUCTION_OF_F <= FACTR*EPSMCH"

can anyone help?



###########################################################################

SK.FIT(XDATA=a,XDATAname="a",PHI1=1,v=5,vlo=2,vhi=300,phi2lo=.01)
[[1]]
[[1]]$par
[1]  -0.01377906   0.83859445   0.34675230 300.00000000

[[1]]$value
[1] 90.59185

[[1]]$counts
function gradient 
      53       53 

[[1]]$convergence
[1] 0

[[1]]$message
[1] "CONVERGENCE: REL_REDUCTION_OF_F <= FACTR*EPSMCH"

#################################################################################



i ghave included the function used in the optim call:

SKEWMLE=function(l,DATA=XDATA,...)
	{
		#alpha = l[1]
		#beta = l[2]
		#phi2 = l[3]
		#v= l[4]
		phi1=PHI1

		DATA<-as.matrix(DATA)
	
		fnew<-function(x,y,l,...)
		{
			#when we do not estimate phi1
			t1=(1+((y-l[1]-l[2]*x)^2)/(l[4]*l[3]^2))^(-0.5*(1+l[4]))
			t2=(1+(x^2)/l[4])^(-0.5*(1+l[4]))
			t3=2*((gamma(0.5*(1+l[4]))/(gamma(0.5*l[4])*sqrt(l[4]*pi)))^2)/l[3]

			t1*t2*t3
		}

		a<-double(length(DATA))
		y=DATA
		a=apply(y,1,function(q)
log(integrate(fnew,lower=0,upper=Inf,y=q,l=l)$value))
		-sum(a)
	}


More information about the R-help mailing list