File: lambda.reg.R

package info (click to toggle)
r-cran-eipack 0.2-2-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 476 kB
  • sloc: ansic: 1,155; makefile: 5
file content (20 lines) | stat: -rw-r--r-- 619 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
lambda.reg <- function(object, columns){

  if (inherits(object,"eiReg")==FALSE)
    stop("'object' must be output from 'ei.reg'")
  if (missing(columns) | length(columns) < 2)
    stop("'columns' requires at least two column names")

  coefs <- matrix(NA, nrow(object$coef), length(columns))
  rownames(coefs) <- rownames(object$coef)
  colnames(coefs) <- columns

  for(i in columns){
    coefs[,i] <- object$coef[,i]/apply(object$coef[,columns],1,sum)
  }

  se <- delta(object, columns)
  lambda.out <- list(call = match.call(), lambda = coefs, se = se)
  class(lambda.out) <- c("lambdaReg", "list")
  lambda.out
}