2

CoxPH テストを行うために R で BMA パッケージを実行しました。この問題「引数は行数が異なることを意味します:146、0」を解決できるように、データを何を編集すればよいか疑問に思っています。

library(BMA)
data <- read.csv("Test1.csv", header = TRUE)

 x<- data[1:146,]

 x <- data[,c(  "dom_econ_2","llgdp", "pcrdbofgdp")]
surv.t<- x$crisis1
 cens<- x$cen1

test.bic.surv<- bic.surv(x, surv.t, cens, factor.type=Ture,  strict=FALSE, nbest=200)

Error in data.frame(mm[, -1], surv.t = surv.t, cens = cens) : 
  arguments imply differing number of rows: 146, 0

の建設data

data <- read.table(text=" country  Start crisis1 cen1      llgdp pcrdbofgdp dom_econ_2
1              Algeria   1988      48    1  90.537788  65.226883       0.00
2              Algeria   1994      24    1  43.727940   5.994088      14.25
3            Argentina   1985      96    0  12.049210  12.676220       0.00
4            Argentina   2002      12    1  27.514610  18.335609      14.96
5            Australia   1985      12    0  36.909191  30.567970       0.00
6            Australia   1997      12    1  60.054508  69.576698     104.06
7            Australia   2000      12    1  64.405777  80.765381      89.13
8            Australia   2008      12    1  95.728081 115.909699     237.16
9              Austria   2005      12    1  91.344994 108.155701      82.14
10             Belgium   2005      12    1 102.885399  71.527367     114.55
11             Bolivia   1985      12    0   4.461628   4.868293       0.00
12             Bolivia   1987      12    1  13.480320  13.259240       0.00
13             Bolivia   1989      12    1  17.370689  17.162399       0.00
14              Brazil   1985     132    0   7.082396  22.242729       0.00
15              Brazil   1999      12    1  40.434750  30.275040     153.22
16              Brazil   2001      24    1  45.114819  30.151600     133.65
17              Brazil   2008      12    1  57.924221  47.755600     409.57
18              canada   2008      12    1 119.428703 126.900398     225.36
19               Chile   1985      12    0   0.000000   0.000000       0.00
20               Chile   1987      12    1   0.000000   0.000000       0.00
21               Chile   1989      12    1   0.000000   0.000000       0.00
22               Chile   2008      12    1   0.000000   0.000000      35.17
23       Cote D'lvoire   1994      12    1  25.643181  22.177429       2.10
24       Cote D'lvoire   2011      24    1  41.235161  19.288630       4.68
25               china   1986      12    1   0.000000   0.000000       0.00
26               china   1989      12    1  62.773560  71.162529       0.00
27               china   1994      12    1  83.825783  76.370827      67.21
28            Colombia   1985      84    0  29.268551  32.937222       0.00
29            Colombia   1995      12    1  30.042919  30.603430      12.56
30            Colombia   1997      48    1  31.537670  34.393360      17.34
31            Colombia   2002      12    1  16.778780  22.066490      17.12
32          Costa Rica   1987      12    1  35.334270  17.252380       0.00
33          Costa Rica   1991      12    1  30.253300  10.472690       1.01
34          Costa Rica   1995      12    1  25.711729  10.946140       1.88
35  Dominican Republic   1985      12    0  22.065741  38.200081       0.00
36  Dominican Republic   1987      24    1  27.200859  41.605549       0.00
37  Dominican Republic   1990      12    1  23.815241  35.062832       0.77
38  Dominican Republic   2002      24    1  20.893270  38.377579       3.62
39             Ecuador   1985      96    0  24.365290  25.992100       0.00
40             Ecuador   1995      72    1  25.012659  25.226681       3.30
41               Egypt   1989      36    1   0.000000   0.000000       0.00
42               Egypt   2001      12    1   0.000000   0.000000      21.36
43               Egypt   2003      12    1   0.000000   0.000000      21.67
44         El Salvador   1988      12    1   5.249366   4.249679       0.00
45             Finland   1992      12    1  61.804680  93.284843      51.87
46              France   2005      12    1  73.674927  90.176163    1144.92
47             Germany   1997      12    1  69.414650 107.758598    1048.86
48             Germany   1999      12    1  85.617897 115.610901    1037.57
49             Germany   2005      12    1 105.417099 111.763199    1297.82
50              Greece   1985      24    0  58.569908  37.887230       0.00
51              Greece   1990      12    1  68.117287  34.083881      30.32
52              Greece   1999      36    1  55.327202  36.298470      44.28
53              Greece   2005      12    1  85.200127  73.185272      77.85
54           Guatemala   1986      12    1  23.963770  14.939860       0.00
55           Guatemala   1989      24    1  22.968491  14.576470       0.00
56            Honduras   1990      12    1  31.085350  29.356951       0.60
57            Honduras   1993      24    1  29.533979  25.364269       0.91
58            Honduras   1996      12    1  28.978729  22.788309       0.86
59             Hungary   1989      12    1  39.513908  44.371880       0.00
60             Hungary   1991      12    1  44.693378  42.222179      18.29
61             Hungary   1993      12    1  52.589550  28.814779      21.60
62             Hungary   1995      36    1  44.789848  21.890961      21.87
63             Hungary   1999      12    1  44.038410  24.015810      21.43
64             Iceland   1985      24    0  21.419769  34.361641       0.00
65             Iceland   1988      24    1  25.819929  34.976372       0.00
66             Iceland   2008      12    1  93.622017 184.647003       0.00
67               India   1988      12    1  40.268990  28.615240       0.00
68               India   1991      12    1  40.929920  23.150181      55.40
69               India   1993      12    1  42.146000  22.969900      53.35
70               India   2008      12    1  69.759697  44.396610     207.09
71           Indonesia   1997      24    1  50.021770  53.528721      40.59
72           Indonesia   2000      12    1  49.576542  17.631670      27.06
73           Indonesia   2008      12    1  36.236462  23.411659     101.12
74             Ireland   1993      12    1  46.543369  42.833199      16.32
75             Ireland   1997      12    1  69.748718  72.668739      22.49
76             Ireland   2005      12    1  87.587280 141.341995      51.42
77               Italy   1992      12    1  61.862431  57.690781     537.05
78               Italy   2005      12    1  58.811539  85.478607     856.04
79            Malaysia   1997      12    1 116.673599 139.381607      21.01
80              Mexico   1985      36    0  23.277300  10.972870       0.00
81              Mexico   1989      12    1  12.128950  11.774920       0.00
82              Mexico   1994      24    1  27.620720  33.321041      64.37
83              Mexico   1998      12    1  31.633909  22.903950      60.87
84              Mexico   2008      12    1  25.276720  20.486820     175.60
85             Morocco   1985      12    0  46.630791  28.247660       0.00
86         Netherlands   2005      12    1 111.478996 159.227707     196.86
87         New Zealand   1997      12    1  81.314529  96.649277      20.87
88         New Zealand   2008      12    1  91.273071 143.887497      40.38
89           Nicaragua   1985      24    0   0.000000   0.000000       0.00
90           Nicaragua   1988      48    1   0.000000   0.000000       0.00
91           Nicaragua   1993      12    1   0.000000   0.000000       0.54
92             Nigeria   1985      72    0  33.616810  15.274050       0.00
93             Nigeria   1999      12    1  18.795080  12.470600      10.26
94              Norway   1986      12    1  52.509472  65.354111       0.00
95              Norway   2008      12    1   0.000000   0.000000     138.04
96            Paraguay   1985      24    0  19.059549  13.474090       0.00
97            Paraguay   1989      12    1  18.109470  13.592000       0.00
98            Paraguay   1992      24    1  28.895550  20.640970       0.88
99            Paraguay   1998      24    1  27.359171  27.806259       1.41
100           Paraguay   2001      24    1  27.472139  27.111059       1.27
101               Peru   1985      12    0  18.312740  12.587190       0.00
102               Peru   1987      84    1  14.426420   9.529409       0.00
103               Peru   1998      12    1  29.766150  26.084431       9.76
104        Philippines   1990      12    1  32.946239  19.481730       8.97
105        Philippines   1997      12    1  60.959930  55.599201      15.96
106        Philippines   2000      12    1  57.644821  39.109230      14.52
107             Poland   1985     108    0  38.214378  51.334850       0.00
108             Poland   1995      36    1  27.932590  14.869600      51.27
109             Poland   1999      12    1  37.415001  22.911200      32.18
110             Poland   2008      12    1  48.807541  43.228100     178.28
111           Portugal   2005      12    1  92.989853 135.765900      89.34
112            Romania   1990     144    1   0.000000   0.000000      12.92
113            Romania   2008       12    1  31.392929  36.600521      32.11
114            Romania   2010      12    1  37.728611  45.040459      32.29
115             Russia   1987     120    1   0.000000   0.000000       0.00
116             Russia   1998      24    1   0.000000   0.000000      43.93
117             Russia   2008      12    1   0.000000   0.000000     293.34
118          Singapore   1997      12    1 109.437202 107.355103      29.25
119       South Africa   1985      12    0  51.689949  66.574753       0.00
120       South Africa   1988      12    1  49.117390  67.433647       0.00
121       South Africa   1996      12    1  47.592419 112.563797      41.01
122       South Africa   1998      12    1  53.312820 113.043098      36.40
123       South Africa   2000      24    1  52.709499 127.040100      34.19
124       South Africa   2008      12    1  46.246601 149.139099      80.10
125              Spain   1993      12    1  73.074364  77.935318     129.39
126              Spain   2005      12    1 100.510200 129.920197     159.93
127          Sri Lanka   1989      12    1  35.501869  19.156321       0.00
128             Sweden   1992      12    1  50.942661 124.471397     117.62
129             Sweden   2005      12    1  46.589840 102.645203      97.60
130             Sweden   2008      12    1  56.333191 124.272102     116.23
131        Switzerland   1999      12    1 165.171402 159.786499      27.19
132           Thailand   1997      12    1  90.951942 154.129700      27.92
133           Thailand   2000      12    1 112.097000 116.628799      21.31
134            Tunisia   1986      12    1   0.000000   0.000000       0.00
135             Turkey   1985     204    0  20.020611  15.242030       0.00
136             Turkey   2008      12    1  44.036678  29.615061     175.62
137            Uruguay   1985     156    0  43.514191  34.115601       0.00
138            Uruguay   2001      24    1  45.520069  49.360771       5.82
139          Venezuela   1986      12    1   0.000000   0.000000       0.00
140          Venezuela   1989      96    1   0.000000   0.000000       0.00
141          Venezuela   2002      12    1   0.000000   0.000000      23.89
142          Venezuela   2004      12    1   0.000000   0.000000      28.59
143          Venezuela   2010      12    1   0.000000   0.000000      85.81
144     United Kingdom   1993      12    1  59.609852 106.663597     409.43
145     United Kingdom   2008      12    1 163.094299 197.386902    1093.45
146      United States   2002      24    1  64.508629 169.231400    2012.69", 
   header=TRUE)
4

1 に答える 1