I have written a function, but I was wondering how I could have the function repeat by applying the seq(0, 1.5, by =.1) in place of a?
Here is my R code:
n1 = 20 n2 = 20 T1 = -1.26491106 df = 38 a = "wide" nb <- (n1*n2)/(n1+n2) a = c(medium = 1/2, wide = sqrt(2)/2, verywide = 1)[[a]] OO <- function(t,nb,df,a){ integrand <- function(g){ (1+nb*g)^(-1/2)*(1+t^2/(df*(1+nb*g)))^(-(df+1)/2)*(2*pi)^(-1/2)*g^(-3/2)*exp(-a^2/(2*g)) } num <- a*integrate(integrand,0,Inf)$value denom <- (1+t^2/df)^(-(df+1)/2) return(num/denom) } OO(t=T1,nb=nb,df=df,a=a) ## HERE IS THE FUNCTION ##
applyfunctionshelp.search("apply a function")