Skip to content

Vectorize (scalar) function

2 messages · casperyc, R. Michael Weylandt

#
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.
#
? Vectorize

is the one you need here.

primitives are probably more subtle than you need and there's no such
thing as a "scalar" function by that name.

Michael
On Fri, Mar 23, 2012 at 5:12 PM, casperyc <casperyc at hotmail.co.uk> wrote: