get_simfun: Generate a function that simulates data in accordance with...

View source: R/sim_tools.R

get_simfunR Documentation

Generate a function that simulates data in accordance with the specification in a stats::family object

Description

This function is useful for simulating data that will follow a certain glm model

Usage

get_simfun(family)

Arguments

family

an object of type stats::family

Value

A function that can receive a linear predictor as input and return simulated samples based on the family and link specification in the stats::family object. The arguments of this function are: eta, vector of linear predictors; dispersion, the return value of summary(model)$dispersion, where model is a fitted glm object; and n, vector of group sizes (optional unless family=binomial)

Examples


fam = Gamma('log')
simfun = get_simfun(fam)
sims = simfun(eta = 1, dispersion=1)


audreyrenson/didgformula documentation built on Oct. 9, 2022, 11:45 a.m.