Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Library: glm
See also: glmest genmultlo

Quantlet: genglm
Description: genglm generates data from a GLM model.

Link:
Usage: {y,mu} = genglm(code, x, b {,opt})
Input:
code text string, the short code for the model (e.g. "bilo" for logit or "noid" for ordinary PLM).
x n x k matrix, design.
b k x 1 vector, coefficients.
opt optional, a list with optional input. "glmopt" can be used to set up this parameter. The order of the list elements is not important.
opt.phi nuisance parameter, usually the dispersion parameter.
opt.wx scalar or n x 1 vector, the binomial index vector, only considered for binomial models. If not given, set to 1.
opt.off scalar or n x 1 vector, offset. If not given, set to 0.
opt.pow optional, power for power link.
opt.nbk scalar, extra parameter k for negative binomial distribution. 1/k is supposed to be a positive integer. If not given, set to 1 (geometric distribution).
Output:
y n x 1 vector, response.
mu n x 1 vector, regression.

Note:

Example:
library("glm")
n = 100
b = 2|(-1)
x = normal(n,rows(b))
opt = glmopt("wx",round(uniform(n).*5)+1)
{y,mu} = genglm("bilo",x,b,opt)

Result:
y[i]'s are pseudo-random variables with distribution
Binomial(wx[i],mu[i]) where mu[i]=1/(1+exp(-x[,i]*b).



Author: M. Mueller, 20010228
(C) MD*TECH Method and Data Technologies, 05.02.2006