R/LP.smooth.R

Defines functions LP.smooth

Documented in LP.smooth

LP.smooth <-
function(CR,k, method ="BIC"){ #--CR just denotes the c vector.
  CR.s <- sort(CR^2,decreasing=TRUE,index=TRUE)$x
  aa <- rep(0,length(CR.s))
  if(method == "BIC") {penalty <- log(k)
		} else {
		penalty <- 2}	
   aa[1] <- CR.s[1] - penalty/k
   if(aa[1]< 0){ return(rep(0,length(CR)))  }
   ####Needed an additional if statement to handle m =1 significant
   if(length(CR) > 1){
		for(i in 2: length(CR.s)){
		aa[i] <- aa[(i-1)] + (CR.s[i] - penalty/k)
		}
		}
  CR[CR^2<CR.s[which(aa==max(aa))]] <- 0
return(CR)
}

Try the BayesGOF package in your browser

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

BayesGOF documentation built on May 2, 2019, 8:57 a.m.