Error when using sim.
by Humphrey, Timothy L. (LNG-DAY)
I'm attempting to use relogit. I want to make a model then have the
model predict the outcome on test data. I was told that I can't use the
R predict function to do the prediction. So, I have been reading the
manual to learn how to do prediction. After reading the manual I
produced the following code. But, when I run it, I always get an error
after running the sim function (See below)
> z.out <- zelig(my.formula, data=LR.data, model = "relogit", tau=0.05)
> x.out <- setx(z.out, data=test.d, fn=NULL, cond=TRUE)
> s.out <- sim( z.out, x = x.out )
Error in yvar - qi$ev : non-conformable arrays
In the above example, x.out has 20 samples with 15 explanatory
variables. In addition, when I run sim with x.out having 10,000 samples,
I get a memory limits exceeded error.
Below is what x.out looks like for the above example:
> x.out
cbind(Y, 1 - Y).Y cbind(Y, 1 - Y).V2 X1 X2 X3 X4 X5 X6 X7
X8
1 0 1 0.0000 1.0 0 0 1.0 0.0 0.0000
0.0000
2 0 1 0.0000 0.5 0 0 0.5 0.0 0.0000
0.0000
3 0 1 0.1397 0.5 0 0 0.0 0.5 0.2732
1.0000
4 0 1 0.1397 0.0 0 0 0.0 0.0 0.0000
0.0000
5 0 1 0.0000 1.0 0 0 0.0 0.0 0.0000
0.0000
6 0 1 0.1397 0.5 0 0 0.0 0.5 0.2732
0.0000
7 0 1 0.1397 1.0 0 0 0.5 0.0 0.2732
0.0000
8 0 1 0.2708 1.0 0 0 0.0 0.0 0.0000
0.0664
9 0 1 0.1397 1.0 0 0 1.0 0.0 1.0000
0.0000
10 0 1 0.5270 0.0 0 1 0.0 0.0 0.2732
0.0000
11 1 0 0.0000 0.0 0 0 1.0 0.0 0.2732
0.0000
12 1 0 0.0000 1.0 0 1 1.0 0.0 0.0000
0.0000
13 1 0 0.7583 0.0 0 1 0.5 0.5 0.2732
1.0000
14 1 0 0.1328 0.0 0 0 1.0 0.0 0.0000
0.0000
15 1 0 0.5270 0.0 0 0 0.0 0.0 1.0000
0.0000
16 1 0 0.1328 0.0 0 1 0.0 0.0 0.0000
0.0000
17 1 0 0.0000 1.0 0 0 0.0 0.0 0.0000
0.0000
18 1 0 0.5270 0.5 0 0 1.0 0.0 1.0000
0.0000
19 1 0 1.0000 0.0 0 1 0.0 0.5 1.0000
0.0664
20 1 0 1.0000 0.0 0 0 0.0 0.0 1.0000
0.0000
X9 X10 X11 X12 X13 X14 X15
1 0 0.0000 0.2700 0.1506 0.2498 0.5077 0
2 0 0.0000 0.0601 0.0000 0.1683 0.5077 0
3 0 0.0000 0.0424 0.1506 0.3022 0.7333 0
4 0 0.0000 0.1316 0.3939 0.1417 0.5077 0
5 0 0.1576 0.7785 0.0000 0.2882 0.3143 0
6 0 0.0000 0.0601 0.7959 0.2845 0.5077 0
7 0 0.1576 0.4845 0.0000 0.0231 0.3143 0
8 0 0.0000 0.4061 0.1506 0.0000 0.0000 0
9 0 0.0000 0.3014 0.2063 0.0264 0.5077 1
10 0 0.0000 0.3014 0.4643 0.3881 0.1467 0
11 0 0.0000 0.2034 0.5392 0.2418 0.5077 1
12 0 0.0000 0.1388 0.0000 0.1025 0.1467 0
13 1 0.0000 0.0508 0.2063 0.3312 0.5077 0
14 0 0.0000 0.2215 0.0476 0.2499 0.5077 0
15 0 0.1576 0.6463 0.1506 0.2182 0.5077 0
16 0 0.1576 0.3346 0.4643 0.7887 0.5077 0
17 0 0.1576 0.4845 0.0000 0.0350 0.1467 0
18 0 0.0000 0.0984 0.1506 0.0714 0.1467 0
19 0 0.0000 0.1462 0.0000 0.0000 0.0000 0
20 0 0.0000 0.1777 0.3277 0.3560 0.7333 0