R/weights.R

Defines functions weights.gsm weights.ss

Documented in weights.gsm weights.ss

weights.ss <- 
  function(object, ...){
    if(is.null(object$data)) {
      warning("Input 'object' has no data. Returning object$w as weights")
      w <- object$w
    } else {
      w <- object$data$w
      if(is.null(w)) w <- rep(1, nrow(object$data))
    }
    return(w)
  }

weights.sm <- weights.gsm <-
  function(object, ...){
    w <- object$weights
    if(is.null(w)) w <- rep(1, nrow(object$data))
    return(w)
  }

Try the npreg package in your browser

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

npreg documentation built on July 21, 2022, 1:06 a.m.