search for: normconst

Displaying 2 results from an estimated 2 matches for "normconst".

2007 Sep 12
1
Integrate() error message, I am at a loss
...om n, noncentrality parameters mu and theta. #==========================================================# nctspa <- function(a,n,mu=0,theta=0,renorm=0,rec=0){ #Pass renorm=1 to renormalize the SPA to the pdf. #There is a last argument called rec. DO NOT PASS it! alpha <- mu/sqrt((1+theta/n)) normconst <- 1 if(renorm==1 & rec==0){ term1 <- integrate(nctspa, -Inf, alpha, n=n, mu=mu, theta=theta)$value term2 <- integrate(nctspa, alpha, Inf, n=n, mu=mu, theta=theta)$value normconst <- 1/(term1+term2) } cdf <- numeric() pdf <- cdf c3 <- n^2+2*n*a^2+a^4 c2...
2007 Sep 12
0
Problem with integrate()
...om n, noncentrality parameters mu and theta. #==========================================================# nctspa <- function(a,n,mu=0,theta=0,renorm=0,rec=0){ #Pass renorm=1 to renormalize the SPA to the pdf. #There is a last argument called rec. DO NOT PASS it! alpha <- mu/sqrt((1+theta/n)) normconst <- 1 if(renorm==1 & rec==0){ term1 <- integrate(nctspa, -Inf, alpha, n=n, mu=mu, theta=theta)$value term2 <- integrate(nctspa, alpha, Inf, n=n, mu=mu, theta=theta)$value normconst <- 1/(term1+term2) } cdf <- numeric() pdf <- cdf c3 <- n^2+2*n*a^2+a^4 c2 <- (-2*mu*...