Learn R Programming

RDS (version 0.9-9)

impute.degree: Imputes missing degree values

Description

Imputes missing degree values

Usage

impute.degree(
  rds.data,
  trait.variable = NULL,
  N = NULL,
  method = c("mean", "quantile"),
  quantile = 0.5,
  recruitment.lower.bound = TRUE,
  round.degree = TRUE
)

Arguments

rds.data

an rds.data.frame

trait.variable

the name of the variable in rds.data to stratify the imputation by

N

population size

method

If mean, the weighted mean value is imputed, otherwize a quantile is used.

quantile

If method is "quantile", this is the quantile that is used. Defaults to median

recruitment.lower.bound

If TRUE, then for each individual, the degree is taken to be the minimum of the number of recruits plus one, and the reported degree

round.degree

Should degrees be integer rounded.

Details

This function imputes degree values using the weighted mean or quantile values of the non-missing degrees. Weights are calcualted using Gile's SS if N is not NULL, or RDS-II if it is. If a trait variable is specified, means and quantile are calculated within the levels of the trait variable

Examples

Run this code
data(faux)
rds.data <- faux
rds.data$network.size[c(1,2,30,52,81,101,108,111)] <- NA
impute.degree(rds.data)
impute.degree(rds.data,trait.variable="X")
impute.degree(rds.data,trait.variable="X",method="quantile")

Run the code above in your browser using DataLab