Message-ID: <53D23856-10C2-4BBE-96D6-7DF3D2DA9F4B@iberstat.es>
Date: 2010-10-29T09:34:30Z
From: Olivier Nuñez
Subject: [R-es] what´s wrong with this code?
In-Reply-To: <1553168318.20101029112024@us.es>
Por otro lado, el calculo de la integral de exp(-x^2)*y sobre y=0..1,
parece más bien trivial!
¿no habrá un error en la formulación de tu función g?
Un saludo. Olivier
--
____________________________________
Olivier G. Nuñez
Email: onunez en iberstat.es
Tel : +34 663 03 69 09
Web: http://www.iberstat.es
____________________________________
El 29/10/2010, a las 11:20, José Manuel Gavilán Ruiz escribió:
> Hello, I want to maximize a likelihood function expressed as an
> integral that can not be symbolically evaluated. I expose my problem
> in a reduced form.
>
> g<- function(x){
> integrand<-function(y) {exp(-x^2)*y}
> g<-integrate(integrand,0,1)
> }
> h<-function(x) log((g(x)))
>
> g is an object of the class function, but g(2) is a integrate object,
> I can print(g(2)) an get a result, but
> if I try h(2) R says is a nonnumeric argument for a mathematical
> function. My goal is to maximize h.
> what´s wrong?
>
> thanks
>
> _______________________________________________
> R-help-es mailing list
> R-help-es en r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-help-es