rglm: Title

Description Usage Arguments Value Examples

View source: R/glmplot.R

Description

Title

Usage

1
2
3
rglm(n = 36, link = "id", dist = "normal", beta = c(1, 1, 1, 0.1, 0.1,
  0.1), xes = list(x1 = c(10, 170), x2 = 3, x3 = c(5, 25), x4 = 2), s = 1,
  seed = NULL)

Arguments

n

number of y values to generate

link

link function "id", "sqrt", "log", "logit", "cloglog"

dist

one of "normal", "poisson", "binomial"

beta

6-vector of regression coefficients

xes

list describing all regressors as either number of levels or range of continuous uniform

s

sd if "normal", size if "binomial"

seed

for random number generator

Value

data.frame of y vector and X matrix

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
## Not run: 
plotglm(icon=E.coli,colo=c("gray","yellow"),col="darkgrey",
 data = rglm(dist="poisson",xes=list(x1=c(10,170),x2=3,x3=9,x4=2)))
# Regressoren bedeuten: x-Achse, Farbe, Größe, Drehung
daten <- rglm(dist="poisson",
              xes=list(x1=c(10,20),x2=2,x3=c(0.7,2.5),x4=c(-2,6)),
              beta=c(1,0.5,2,.03,1,0.7))
plotglm(icon=E.coli,colo=c("gray","green"),col="darkgrey",rot=10,
        iex=.2, str=0.3, data = daten)
daten <- rglm(n=12,dist="binomial",
              xes=list(x1=c(7,14),x2=1,x3=1,x4=1),
             beta=c(0,0.032,0,0,0,0))
daten[,5] <- daten[,1]
daten[,4] <- daten[,2]/10
plotglm(icon=zebrafish,colo=c("n"),col="black",rot=pi,
        iex=.04, str = 1.3, data = daten)
est <- glm(y~x.x1,family='binomial',data=daten)
new <- data.frame(x.x1=(1:200)/10)
odd <- exp(predict(est,newdata=new))
P <- odd/(1+odd)
lines(new$x.x1,P)
abline(v=-est$coefficients[1]/est$coefficients[2],h=c(0,0.5,1),lty=2)

## End(Not run)

vonthein/illustrator documentation built on Nov. 7, 2019, 4:32 p.m.