Library: | glm |
See also: | glmbilo genmultlo |
Macro: | genbilo | |
Description: | genbilo generates data from a logit model, i.e. y from Binomial(m,p) with P(y=1)=1./(1+exp(-x*b)) |
Usage: | {y,p} = genbilo(x,b{,m}) | |
Input: | ||
x | n x k matrix, design. | |
b | k x 1 vector, coefficients. | |
m | optional, n x 1 vector. | |
Output: | ||
y | n x 1 vector, binomial. | |
p | n x 1 vector, probabilities. |
library("glm") n = 100 b = 2|(-1) x = normal(n,rows(b)) m = ceil(uniform(n).*5) {y,p} = genbilo(x,b,m)
y[i] is a pseudo random variable with distribution Binomial(m[i],p[i]) where p[i]=1/(1+exp(-x[,i]*b)
Library: | glm |
See also: | glmbilo genmultlo |