R/npnormc.R

Defines functions npnormc

Documented in npnormc

#' Compute the non-parametric mixing distrbution of sample 
#' correlation coefficients with components fixed
#'
#' This function uses the non-parametric method to compute the mixing
#' distribution of the sample correlatio coefficients based on maximum
#' likelihood with components fixed when the density is approximated to be
#' a one-parameter normal.
#'
#' @title Mon-parametric method and components fixed when the component is normal.
#' @param data the vector of observation to compute the mixing distribution
#' @param mu0 the vector of fixed support points
#' @param pi0 the vector of probabilities corresponding to support points
#' @param n the number of observations to construct the sample correlation matrix
#' @param mix the initial mixing distribution
#' @param maxit the maximum iterations allowed.
#' @param tol the tolerence. Stop if the directional derivative is less than tol
#' @return the nspmix object.
#' @rdname npnormcfc
#' @export
npnormc = function(data, mu0 = 0, pi0 = 0, n, mix = NULL, maxit = 100, tol = 1e-6){
  if (is.null(mix)) mix = initnpnorm(data, mu0, pi0)
  r = npnormcfc(data, mu0, pi0, n, mix$pt, mix$pr, maxit, tol)     
  attr(r, "class") = "nspmix" 
  r
}
xiangjiexue/npfixedcomp documentation built on June 15, 2020, 9:18 a.m.