R/lambda0.R

Defines functions lambda0

Documented in lambda0

lambda0=function(x,y,weights=rep(1,N),exclude=NULL){
  if(length(exclude))x=x[,-exclude]
  N=length(y)

  ybar=weighted.mean(y,weights)
  yvar=weighted.mean((y-ybar)^2,weights)
  y=(y-ybar)/sqrt(yvar)
  weights=weights/N
  
  xbar=t(weights)%*%x
  xvar=t(weights)%*%(x^2)-xbar^2

  grad= abs(t(y*weights)%*%x)/sqrt(xvar)
  max(grad)
}

Try the sparsenet package in your browser

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

sparsenet documentation built on May 29, 2017, 2:19 p.m.