R/bernstein.R

Defines functions bernstein int.bernstein

Documented in bernstein int.bernstein

bernstein <- function(v,x,n) {
  return((choose(n,v)*x^v*(1-x)^(n-v))*(n+1))
}

int.bernstein <- function(x,n) {
  base.int.h <- apply(matrix(0:n),1,bernstein,x,n=n)

  dim.base <- dim(base.int.h)

  base.int <- matrix(0,nrow=dim.base[1],ncol=(dim.base[2]-1))

  for(j in 1:(dim.base[2]-1)) {
    for(i in 1:dim.base[1]) {
      base.int[i,j] <- sum(base.int.h[i,((j+1):dim.base[2])])/(n+1)
    }
  }
  return(base.int)
}

Try the pencopula package in your browser

Any scripts or data that you put into this service are public.

pencopula documentation built on May 2, 2019, 7:21 a.m.