Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fortran runtime error: Bad value during integer read #3

Closed
inbokrhee opened this issue Jun 5, 2018 · 4 comments
Closed

Fortran runtime error: Bad value during integer read #3

inbokrhee opened this issue Jun 5, 2018 · 4 comments

Comments

@inbokrhee
Copy link

Thanks for providing this package!

I'm trying to run dw-nominate in a setting where there is only a small number of rollcall votes (and relatively small number of legislators). I'm getting an error that says "Fortran runtime error: Bad value during integer read" and am not sure whether it's because of the data constraint, about my session environment, something with the gcc/fortran, or all of these.

I ran these on a mac command-line R. My output and sessionInfo posted below as well. If you could point me towards some direction as to how I might be able to fix this, I'd greatly appreciate it. Thanks!

> library(dwnominate)
> results = dwnominate(rolls, id = "mpid", polarity = "KABANDO WA KABANDO", minvotes=12)
Running Optimal Classification to get starting estimates...

Preparing to run Optimal Classification...

	Checking data...

		... 230 of 530 total members dropped.

		Votes dropped:
		... 10 of 64 total votes dropped.

	Running Optimal Classification...

		Generating Start Coordinates...
		Running Edith Algorithm...
		Getting normal vectors...
		Getting legislator coordinates...
		Getting normal vectors...
		Getting legislator coordinates...
		Getting normal vectors...
		Getting legislator coordinates...
		Getting normal vectors...
		Getting legislator coordinates...
		Getting normal vectors...
		Getting legislator coordinates...
		Getting normal vectors...
		Getting legislator coordinates...
		Getting normal vectors...
		Getting legislator coordinates...
		Getting normal vectors...
		Getting legislator coordinates...
		Getting normal vectors...
		Getting legislator coordinates...
		Getting normal vectors...
		Getting legislator coordinates...


Optimal Classification completed successfully.
Optimal Classification took 3.986 seconds to execute.

Writing DW-NOMINATE input files...

rollcall_input.dat
rollcall_output.dat
legislator_input.dat
legislator_output.dat
session_info.num
rollcall_matrix.vt3
transposed_rollcall_matrix.vt3
NOMINAL DYNAMIC-WEIGHTED MULTIDIMENSIONAL UNFOLDING
    2    1    1    2    1    5
  5.9539  0.3463
 NUMBER OF CONGRESSES     2
 TOTAL ROLL CALLS 01-108      64
At line 339 of file dwnom.f (unit = 20, file = 'legislator_input.dat')
Fortran runtime error: Bad value during integer read
> sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.4

Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.17         splines_3.5.0        MASS_7.3-49          evd_2.3-3            bit_1.1-14           prodlim_2018.04.18
 [7] ffbase_0.12.3        RecordLinkage_0.4-10 xtable_1.8-2         lattice_0.20-35      fastmatch_1.1-0      ada_2.0-5
[13] blob_1.1.1           tools_3.5.0          nnet_7.3-12          grid_3.5.0           ipred_0.9-6          data.table_1.11.4
[19] ff_2.2-14            e1071_1.6-8          DBI_1.0.0            class_7.3-14         survival_2.41-3      bit64_0.9-7
[25] digest_0.6.15        Matrix_1.2-14        lava_1.6.1           rpart_4.1-13         memoise_1.1.0        RSQLite_2.1.1
[31] compiler_3.5.0
@inbokrhee
Copy link
Author

I've just filled in any missing values in the legis.data, and it proceeded without the previous error. But now I am getting something else, namely " *** caught segfault *** address 0x7fff2c600d3c, cause 'memory not mapped'". I browsed through stackoverflow and it seems the cause of this type of error can be very diverse..

results = dwnominate(rolls, id = "mpid", polarity = "KABANDO WA KABANDO", minvotes=11)
Running Optimal Classification to get starting estimates...

Preparing to run Optimal Classification...

	Checking data...

		... 197 of 530 total members dropped.

		Votes dropped:
		... 10 of 64 total votes dropped.

	Running Optimal Classification...

		Generating Start Coordinates...
		Running Edith Algorithm...
		Getting normal vectors...
		Getting legislator coordinates...
		Getting normal vectors...
		Getting legislator coordinates...
		Getting normal vectors...
		Getting legislator coordinates...
		Getting normal vectors...
		Getting legislator coordinates...
		Getting normal vectors...
		Getting legislator coordinates...
		Getting normal vectors...
		Getting legislator coordinates...
		Getting normal vectors...
		Getting legislator coordinates...
		Getting normal vectors...
		Getting legislator coordinates...
		Getting normal vectors...
		Getting legislator coordinates...
		Getting normal vectors...
		Getting legislator coordinates...


Optimal Classification completed successfully.
Optimal Classification took 4.776 seconds to execute.

Writing DW-NOMINATE input files...

rollcall_input.dat
rollcall_output.dat
legislator_input.dat
legislator_output.dat
session_info.num
rollcall_matrix.vt3
transposed_rollcall_matrix.vt3
NOMINAL DYNAMIC-WEIGHTED MULTIDIMENSIONAL UNFOLDING
    2    1    1    2    1    5
  5.9539  0.3463
 NUMBER OF CONGRESSES     2
 TOTAL ROLL CALLS 01-108      64
 TOTAL LEGISLATORS 01-108    582
 LNL      6937      6937      -4808.363  1.0000  0.5000  1.0000  0.3463  5.9539
 LNL      6937      6937      -4808.363  1.0000  0.5000  1.0000  0.3563  5.9539
 LNL      6937      6937      -4808.363  1.0000  0.5000  1.0000  0.3363  5.9539
 LNL      6937      6937      -4808.363  1.0000  0.5000  1.0000  0.3463  5.9539
 LNL      6937      6937      -4808.363  1.0000  0.5000  1.0000  0.3463  6.0539
 LNL      6937      6937      -4808.363  1.0000  0.5000  1.0000  0.3463  5.8539
 NUMBER RCs & CLASSIFICATION       64       54     6937     5785     5920     2157
                                0.8534  0.5285
 LNL      6937      5920      -2377.753  0.8534  0.7098  1.0000  0.3463  5.9539
 UNIQUE LEGISLATORS   535     0     0     0     6937
                         -1603.204      -1603.204      -1603.204      -1603.204
 LNL      6937      6313      -1603.204  0.9100  0.7937  1.0000  0.3463  5.9539
     6937      -1603.204      -1603.204
 LNL      6937      6313      -1603.204  0.9100  0.7937  1.0000  0.3463  5.9539
 LNL      6937      6304      -1597.150  0.9088  0.7943  1.0000  0.3563  5.9539
 LNL      6937      6307      -1611.619  0.9092  0.7927  1.0000  0.3363  5.9539
 LNL      6937      6304      -1597.150  0.9088  0.7943  1.0000  0.3563  5.9539
 LNL      6937      6293      -1593.417  0.9072  0.7948  1.0000  0.3663  5.9539
      -1593.417      -1593.417
 LNL      6937      6292      -1591.962  0.9070  0.7949  1.0000  0.3763  5.9539
      -1591.962      -1591.962
 LNL      6937      6283      -1592.733  0.9057  0.7949  1.0000  0.3863  5.9539
      -1591.962      -1592.733
 LNL      6937      6287      -1592.073  0.9063  0.7949  1.0000  0.3813  5.9539
      -1591.962      -1592.073
 LNL      6937      6290      -1591.948  0.9067  0.7949  1.0000  0.3788  5.9539
      -1591.948      -1591.948
 LNL      6937      6287      -1592.073  0.9063  0.7949  1.0000  0.3813  5.9539
      -1591.948      -1592.073
 LNL      6937      6289      -1591.992  0.9066  0.7949  1.0000  0.3800  5.9539
      -1591.948      -1591.992
 LNL      6937      6289      -1591.969  0.9066  0.7949  1.0000  0.3794  5.9539
      -1591.948      -1591.969
 LNL      6937      6290      -1591.955  0.9067  0.7949  1.0000  0.3791  5.9539
      -1591.948      -1591.955
 LNL      6937      6290      -1591.952  0.9067  0.7949  1.0000  0.3790  5.9539
      -1591.948      -1591.952
 LNL      6937      6290      -1591.949  0.9067  0.7949  1.0000  0.3789  5.9539
      -1591.948      -1591.949
 LNL      6937      6290      -1591.950  0.9067  0.7949  1.0000  0.3788  5.9539
      -1591.948      -1591.950
 LNL      6937      6290      -1591.949  0.9067  0.7949  1.0000  0.3788  5.9539
      -1591.948      -1591.949
 LNL      6937      6290      -1591.945  0.9067  0.7949  1.0000  0.3788  5.9539
      -1591.945      -1591.945
 LNL      6937      6290      -1591.949  0.9067  0.7949  1.0000  0.3788  5.9539
      -1591.945      -1591.949
 LNL      6937      6290      -1591.945  0.9067  0.7949  1.0000  0.3788  5.9539
 LNL      6937      6290      -1583.979  0.9067  0.7959  1.0000  0.3788  6.0539
 LNL      6937      6290      -1600.530  0.9067  0.7940  1.0000  0.3788  5.8539
 LNL      6937      6290      -1583.979  0.9067  0.7959  1.0000  0.3788  6.0539
 LNL      6937      6290      -1576.601  0.9067  0.7967  1.0000  0.3788  6.1539
      -1576.601      -1576.601
 LNL      6937      6290      -1569.794  0.9067  0.7975  1.0000  0.3788  6.2539
      -1569.794      -1569.794
 LNL      6937      6290      -1563.532  0.9067  0.7982  1.0000  0.3788  6.3539
      -1563.532      -1563.532
 LNL      6937      6290      -1557.802  0.9067  0.7989  1.0000  0.3788  6.4539
      -1557.802      -1557.802
 LNL      6937      6290      -1552.580  0.9067  0.7995  1.0000  0.3788  6.5539
      -1552.580      -1552.580
 LNL      6937      6290      -1547.850  0.9067  0.8000  1.0000  0.3788  6.6539
      -1547.850      -1547.850
 LNL      6937      6290      -1543.597  0.9067  0.8005  1.0000  0.3788  6.7539
      -1543.597      -1543.597
 LNL      6937      6290      -1539.800  0.9067  0.8009  1.0000  0.3788  6.8539
      -1539.800      -1539.800
 LNL      6937      6290      -1536.453  0.9067  0.8013  1.0000  0.3788  6.9539
      -1536.453      -1536.453
 LNL      6937      6290      -1533.529  0.9067  0.8017  1.0000  0.3788  7.0539
      -1533.529      -1533.529
 LNL      6937      6290      -1531.019  0.9067  0.8020  1.0000  0.3788  7.1539
      -1531.019      -1531.019
 LNL      6937      6290      -1528.916  0.9067  0.8022  1.0000  0.3788  7.2539
      -1528.916      -1528.916
 LNL      6937      6290      -1527.194  0.9067  0.8024  1.0000  0.3788  7.3539
      -1527.194      -1527.194
 LNL      6937      6290      -1525.852  0.9067  0.8026  1.0000  0.3788  7.4539
      -1525.852      -1525.852
 LNL      6937      6290      -1524.871  0.9067  0.8027  1.0000  0.3788  7.5539
      -1524.871      -1524.871

 *** caught segfault ***
address 0x7fff2c600d3c, cause 'memory not mapped'

Traceback:
 1: dwnominate(rolls, id = "mpid", polarity = "KABANDO WA KABANDO",     minvotes = 11)

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Selection: 1
R is aborting now ...
[1]    32624 segmentation fault  R

@wmay
Copy link
Owner

wmay commented Jun 6, 2018

The NA's are an issue. I didn't think to handle NA values for the legislator data, so I should fix that.

As for the segfault, my first two questions are:

  1. Did the example with the senate data run for you?
  2. Are you using gfortran 4.8, as described here?

Assuming the example runs and you installed the package with gfortran 4.8, I can look through the fortran code to try to get an idea of where the segfault occurred. Fair warning though, this can be difficult to debug and I don't know if I will be able to give you the answer or how long it'll take me to find it. (Though I will definitely give it a try because these segfaults annoy me.)

Do you really only have 2 congresses in your data? The DW-NOMINATE fortran code won't estimate a dynamic model unless there are at least 5 congresses, so the results, if it runs, should be nearly identical to W-NOMINATE. The wnominate package is much more stable and mature than this one and I definitely recommend it unless you specifically need to estimate a dynamic model.

@inbokrhee
Copy link
Author

Thanks for the quick response!

The senate example did work, but not my own data. And yes, I used gfortran 4.8. But when I used another laptop (also MacOS) later, it did work and gave me output, so it might be that my configuration in this laptop is somehow off.

I currently only have 2 congresses but am in the process of cleaning some more data and adding more. This was more of a learning/trial process for me, and the codes did give me outputs which seems to have some face validity, but as you said they also seem to be very close to W-Nominate. Thanks!

@wmay
Copy link
Owner

wmay commented Jul 21, 2018

I made a series of commits that should fix the legis.data NA problem, and hopefully a lot of the segfault problems as well, so I'm going to mark this as closed (unless you find that it still isn't working).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants