[R-br] optimize

Daniela Recchia daniela_recchia em yahoo.com.br
Terça Novembro 1 15:01:50 BRST 2011


Olá pessoal,

estou tentando maximizar uma função usando o optmize, mas recebo sempre uma mensagem de erro. Já olhei o help mas não percebo onde estou errando.

Minha função é:


n=10000

L<-function(beta){
vv<-matrix(nrow=n,ncol=1)
for(i in 1:n){
L<- -a[i]*log(dnorm(x[i]*beta))
vv[i,1]<-L
}
print(vv)
}

ja tenho definidos o "a" e o "x", quero maximizar essa função para estimar meu beta.

optimize(L,c(-1,1))
Error in optimize(L, c(-1, 1)) : invalid function value in 'optimize'


Alguém tem uma sugestão?

Obrigada

 
-- 
Daniela Rodrigues Recchia

Master Student of Statistics - Technische Universität Dortmund.

"It is better to have an inexact answer to the right question than a precise one to the wrong question!"
John Tuckey
-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: <http://listas.inf.ufpr.br/pipermail/r-br/attachments/20111101/5a76eb5b/attachment.html>


Mais detalhes sobre a lista de discussão R-br