[R] Vectorize (scalar) function

casperyc casperyc at hotmail.co.uk
Fri Mar 23 22:12:40 CET 2012


Hi all,

myint=function(mu,sigma){
	integrate(function(x) dnorm(x,mu,sigma)/(1+exp(-x)),-Inf,Inf)$value
}

x=seq(0,50,length=3000)
x=x[-1]
plot(x,myint(4,x))  # not working yet

I think I have to 'Vectorize' it somehow?

What's a scalar function? and a primitive function?

Thanks.

casper




-----
###################################################
PhD candidate in Statistics
School of Mathematics, Statistics and Actuarial Science, University of Kent
###################################################

--
View this message in context: http://r.789695.n4.nabble.com/Vectorize-scalar-function-tp4500181p4500181.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list