Displaying 1 result from an estimated 1 matches for "gauher".
Did you mean:
gather
2012 Feb 29
2
Converting a function from Splus to R
...r Splus, when I run it in R I obtain get an error
because the function has the elements "0.d0" and "2.d0". How can I change it
to run in R?
The function can be found in page 230 from
http://www.stat.wisc.edu/~mchung/teaching/stat471/stat_computing.pdf
Function is as follows:
gauher <- function(n) {# Gauss-Hermite: returns x,w so that
#\int_-\infty^\infty exp(-x^2) f(x) dx \doteq \sum w_i f(x_i)
EPS <- 3.e-14
PIM4 <- .7511255444649425D0
MAXIT <- 10
m <- trunc((n+1)/2)
x <- w <- rep(-1,n)
for (i in 1:m) {
if (i==1) {
z <- sqrt(2*n+1)-1.85575*(2*n+1)^(-.1...