Re: [R] Generate a function

From: Uwe Ligges <ligges_at_statistik.uni-dortmund.de>
Date: Fri 22 Jul 2005 - 20:51:47 EST

herodote@oreka.com wrote:

> hi all,
>
> I need to generate a function inside a loop:
>
> tmp is an array

Well, a 1-d array, or better say a vector of length 10, given the code below is correct.

> for (i in 1:10)
> {
> func<- func * function(beta1) dweibull(tmp[i],beta1,eta)
> }
>
> because then i need to integrate this function on beta.
>
> I could have written this :
>
> func<-function(beta1) prod(dweibull(tmp,beta1,eta)) (with eta and beta1 set)
>
> but it is unplottable and no integrable... i could make it a bit different but if i do that ( prod(tmp)=~Inf ) i'm stuck.
>
 >
> I've looked in R-poetry and i didn't find anything usefull.
>
> I think i have a problem with how i tell R my function is, R seems to think it is a function like programmers do but not a f(x) function.

Please specify a reproducible example (as the posting guide asks to do), that means including the values for tmp, beta1 and eta. Then we might be able to explain where you have your problems.

Uwe Ligges

> Thks
> guillaume
>
> ////////////////////////////////////////////////////////////
> // Webmail Oreka :
http://www.oreka.com
> ////////////////////////////////////////////////////////////
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri Jul 22 20:58:34 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:33:55 EST