-
Notifications
You must be signed in to change notification settings - Fork 12
/
test.R
44 lines (35 loc) · 1.38 KB
/
test.R
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
require(idealstan)
require(dplyr)
require(ggplot2)
require(lubridate)
data('delaware')
# Absent to missing
delaware$outcome[delaware$outcome=="Absent"] <- NA
# adjust data to 0/1
delaware$outcome <- as.numeric(delaware$outcome=="Yes")
delaware_data <- id_make(delaware,outcome_disc = 'outcome',
person_id = 'person_id',
item_id = 'item_id',
group_id= 'group_id',
time_id='time_id')
del_est_ar2 <- id_estimate(delaware_data,
model_type = 1,
use_groups = T,
fixtype='prefix',
nchains=2,time_var=10,
ncores=16,
vary_ideal_pts='AR1',
restrict_ind_high = "D",
restrict_ind_low="R",
seed=84520)
del_est_gp1 <- id_estimate(delaware_data,
model_type = 1,
use_groups = T,
fixtype='prefix',
nchains=2,
ncores=16,
niters = 500,
vary_ideal_pts='GP',
restrict_ind_high = "D",
restrict_ind_low="R",
seed=84520)