File: strata.R

package info (click to toggle)
zelig 3.3-1-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 30,800 kB
  • ctags: 470
  • sloc: sh: 81; makefile: 10
file content (27 lines) | stat: -rw-r--r-- 706 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

data(turnout)
z.out1 <- zelig(vote ~ educate + age + income, model = "logit", data = turnout, by = "race")
user.prompt()
##  Viewing the regression output:
summary(z.out1)

##  Using setx to generate baseline and alternative values for the
##  explanatory variables.  
user.prompt()
x.out1 <- setx(z.out1, age = 65)

##  Simulating quantities of interest (predicted probabilites, risk
##  ratios, and risk differences):
user.prompt()
s.out1 <- sim(z.out1, x = x.out1)
user.prompt()
## Summarizing the simulated quantities of interest:
summary(s.out1)
user.prompt()

## Conditional prediction:
x.out2 <- setx(z.out1, fn = NULL, cond = TRUE)
s.out2 <- sim(z.out1, x = x.out2)
user.prompt()
summary(s.out2)