[R] FW: Completing Unordered Categorical missing variables using package mi

IOANNA IOANNOU ii54250 at msn.com
Thu Jun 18 15:15:54 CEST 2015


 

Hello all, 

 

A perhaps simple question. I am trying to complete unordered categorical
missing data using mi package. There are two variables with missing data:
Mat and Use. The problem is that the Use has several categories and somehow
this means I can't plot the results as I get this error. Any idea how to fix
the problem?

Any help much appreciated, 

Best, 

Ioanna

 

new<-read(Sample.csv)

new$Use<-factor(new$Use)

MissingData <- missing_data.frame(new)

MissingData <- change(MissingData, y = "DS", what = "type", to =
"ordered-categorical")

 

# STEP 3: look deeper

summary(MissingData)

summary(MissingData at patterns)

show(MissingData)

hist(MissingData)

 

 

# STEP 4: impute

## Not run: 

IMPsample <- mi(MissingData)

 

 

#STEP5: diagnostics

Plot(IMPsample)

 

Error in `rownames<-`(`*tmp*`, value = c("Oc11", "Oc12", "Oc13", "Oc14",  : 

  length of 'dimnames' [1] not equal to array extent

 

Data

new

      DS  Use Material     Surface    IM

31237  3 Oc22     Wood   95.710401 3.148

48947  1 Oc19     Wood  124.427200 1.762

7038   5 Oc11     Wood  142.113800 1.890

8150   3 Oc32    Steel   70.709451 2.530

43471  1 Oc19       NA    3.609650 1.597

24815  5 Oc11     Wood  121.541500 3.638

8683   2 Oc11     Wood   80.341550 2.242

47303  1 Oc39       NA   19.018000 1.410

27467  5 Oc11     Wood   86.799050 3.782

35026  2 Oc11     Wood  113.185700 2.565

50635  5 Oc19       NA   28.169550 3.887

9459   2 Oc11     Wood   40.825350 1.779

14042  2 Oc13    Steel   36.233100 4.293

17393  3 Oc11     Wood   56.069700 2.833

21157  5 Oc11     Wood   89.254700 4.958

42345  2 Oc19       NA    2.973600 0.468

4372   5 Oc11     Wood    7.872750 3.950

16654  5 Oc11     Wood   75.315600 6.395

47335  1 Oc19       NA   14.564400 1.781

49609  5 Oc19       NA   17.249000 3.545

4973   5 Oc19     Wood   28.511699 3.243

44784  2 Oc19       NA    4.473000 2.328

29581  5 Oc11     Wood   96.884250 4.378

31949  3 Oc11     Wood  126.996500 3.225

7352   5 Oc11     Wood   71.905200 3.430

43139  1 Oc19       NA  133.573551 1.849

43350  2 Oc19       NA    3.739350 1.205

11592  2 Oc11     Wood   72.146800 2.906

33767  3 Oc11     Wood   91.578001 2.905

51748  5 Oc39       NA    9.108800 3.138

21160  5 Oc12     Wood  100.677100 4.268

34390  2 Oc12     Wood  120.401199 1.603

23255  5 Oc12     Wood  122.333801 5.557

38414  2 Oc21    Steel   69.686100 3.021

48810  3 Oc29     Wood   79.609950 3.670

44611  2 Oc19       NA   15.328000 1.480

17905  3 Oc11     Wood   61.188500 1.857

35509  2 Oc11     Wood  160.180349 2.511

10252  2 Oc11     Wood   94.414799 1.446

47152  2 Oc19     Wood   12.160450 2.285

43221  2 Oc11     Wood   70.796299 1.361

32569  3 Oc11     Wood   97.269300 2.842

5671   5 Oc11     Wood   84.672250 3.050

1157   3 Oc11     Wood   79.297800 2.612

3441   2 Oc11     Wood  112.435650 2.105

36678  5 Oc21     Wood   27.223500 4.017

52241  5 Oc19     Wood    3.946150 3.373

4688   5 Oc11     Wood   68.009700 3.766

42933  2 Oc19     Wood    3.946801 2.039

31048  5 Oc11     Wood   25.172301 3.633

28660  1 Oc11     Wood  133.387099 1.285

22726  5 Oc12     Wood  216.952900 7.550

22397  5 Oc11     Wood  115.320750 5.825

41008  3 Oc11     Wood   97.253199 1.960

49054  3 Oc21       NA    8.542800 1.329

5594   5 Oc41       RC  264.505000 3.185

45379  3 Oc41     Wood   39.357100 2.909

17498  3 Oc11     Wood   45.544750 1.459

1176   5 Oc11     Wood   87.020400 2.750

33055  1 Oc11     Wood   55.777250 1.437

37071  5 Oc32     Wood  201.629599 3.287

53813  5 Oc19     Wood   56.919600 4.322

11037  2 Oc11     Wood  107.886600 1.479

14453  2 Oc11     Wood  106.369949 2.508

3767   1 Oc11     Wood   71.325500 2.012

52303  5 Oc29       NA    8.916150 6.092

19706  5 Oc19     Wood   25.936699 6.417

37658  5 Oc14     Wood   65.761651 4.317

26195  1 Oc12     Wood   82.510849 0.835

35808  3 Oc13     Wood   54.798851 2.337

6035   5 Oc12     Wood  286.075700 3.905

33383  3 Oc11     Wood   96.809150 2.560

43497  1 Oc19       NA   13.039000 1.103

41777  5   NA       NA   47.153349 2.658

12024  2 Oc11     Wood   19.851000 2.567

39538  1 Oc19       NA   31.996200 2.108

15553  3 Oc19     Wood  197.062201 2.559

31522  3 Oc11     Wood  129.499700 2.906

11916  2 Oc11     Wood   58.358951 2.939

9688   2 Oc11     Wood  106.568201 1.822

1690   3 Oc11     Wood  202.613700 2.290

977    3 Oc11     Wood  179.321800 1.987

12410  2 Oc14    Steel  108.682100 2.821

52428  5 Oc19       NA   36.041699 6.042

14109  2 Oc21    Steel  130.929300 4.178

52769  5 Oc31     Wood   18.525650 2.187

11324  1 Oc11     Wood   94.108351 1.456

12394  2 Oc21       RC 1836.975800 2.415

35991  3 Oc11     Wood  114.716550 2.664

4006   5 Oc39    Steel  309.854000 4.041

43404  2 Oc19       RC   27.745400 1.772

12680  1 Oc21       RC  327.789699 2.669

43607  1 Oc29       NA    5.812499 2.406

33590  3 Oc11     Wood    8.115450 3.183

16230  5 Oc32     Wood  610.293850 6.312

19815  5 Oc11     Wood   89.220350 6.122

4520   5 Oc19     Wood   64.060800 3.248

13684  5 Oc13     Wood   56.124300 5.455

38537  5 Oc21       NA   16.287000 3.270

39657  1 Oc19  Masonry   33.016850 1.705

46738  1 Oc19  Masonry    8.274750 2.268

48304  1 Oc41       NA   11.023500 1.340

25526  5 Oc11     Wood   38.092050 3.400

31818  3 Oc11     Wood   74.741200 2.957

49039  1 Oc19     Wood   26.981200 1.660

7721   3 Oc13     Wood  138.895000 1.620

37074  5 Oc32       RC 1022.963850 3.165

253    3 Oc11     Wood  110.980550 3.450

37050  5 Oc39     Wood   85.076700 3.425

49396  3 Oc29       NA   42.180450 2.044

16432  5 Oc11     Wood   14.516700 6.685

19825  5 Oc11     Wood   79.850800 5.805

37808  5 Oc12     Wood   22.258000 6.500

11931  2 Oc31     Wood    4.754801 2.691

54705  5 Oc52    Steel   22.149050 3.730

49243  3 Oc41       NA   15.386600 3.225

22228  5 Oc11     Wood   66.384300 7.130

19650  3 Oc19     Wood  183.575500 0.786

38384  1 Oc11     Wood   13.056799 2.072

46314  1 Oc39     Wood   34.994200 1.046

38055  5 Oc22    Steel 2376.595001 6.680

309    3 Oc19     Wood  262.443700 2.402

10410  2 Oc11     Wood   97.889400 1.125

13732  3 Oc11     Wood   31.174701 2.146

4072   5 Oc11     Wood   84.427000 4.502

27637  5 Oc11     Wood  102.724099 3.862

16383  5 Oc11     Wood  109.650200 6.319

17287  5 Oc11     Wood  178.604650 0.828

14319  3 Oc11     Wood   28.284451 3.662

38933  0 Oc19       NA   74.362200 1.915

653    2 Oc11     Wood  101.894350 2.427

28381  1 Oc11     Wood   74.662700 1.167

5245   5 Oc19     Wood   49.041400 3.295

10622  2 Oc11     Wood  182.785600 1.332

6015   5 Oc11     Wood  102.267250 2.961

2860   2 Oc11     Wood  129.606700 2.132

53764  5 Oc19       NA    2.226350 4.218

9165   2 Oc11     Wood  112.198350 1.639

21738  5 Oc11     Wood  193.646300 6.375

29152  1 Oc11  Masonry  126.956551 1.398

29473  1 Oc11     Wood  116.963500 1.297

49030  2 Oc19       NA    3.076849 1.292

6409   5 Oc11     Wood   71.559400 2.820

32834  1 Oc11     Wood  191.312099 1.040

6174   5 Oc11     Wood   68.417351 3.125

48700  3 Oc19       NA   13.087300 2.207

54246  5 Oc39     Wood   23.193300 5.701

20891  5 Oc22     Wood   48.977900 6.368

5569   5 Oc11     Wood  112.890051 3.062

26900  5 Oc11     Wood   75.308800 3.982

34282  3 Oc11     Wood   98.636400 2.124

36821  5 Oc11     Wood   35.633750 4.358

839    1 Oc11     Wood   96.719899 1.520

2115   3 Oc19     Wood   96.171801 2.725

3628   1 Oc11     Wood   91.017200 1.277

42766  2 Oc19       NA    4.107900 1.146

47389  1 Oc19       NA    6.752700 0.477

44397  1 Oc19       NA   19.453200 1.712

42148  5 Oc19       NA  115.429750 2.707

30878  3 Oc11     Wood   73.016301 3.727

26881  1 Oc11     Wood  101.604100 1.013

28615  3 Oc22     Wood  313.150399 3.438

15659  3 Oc11     Wood   85.379750 2.347

20772  5 Oc11     Wood   94.530500 5.687

9190   2 Oc11     Wood   86.149100 1.576

21905  5 Oc11     Wood  128.124851 6.313

13342  5 Oc11     Wood   63.338500 4.733

33391  5 Oc32     Wood   87.569600 2.763

31901  3 Oc11     Wood  116.920451 2.478

50713  5 Oc19     Wood 1088.068400 4.433

34860  3 Oc11     Wood   87.190301 2.614

55024  5 Oc39       NA  114.418900 3.638

1518   3 Oc19     Wood   57.937901 2.220

775    2 Oc11     Wood    6.419100 1.874

44361  2 Oc29       NA  228.655249 2.489

18223  3 Oc11     Wood   76.449050 2.351

43388  0 Oc11     Wood  155.973150 1.293

53611  5 Oc11     Wood   91.223350 3.298

54250  5 Oc22     Wood   43.027800 5.360

51390  5 Oc19       NA   20.285000 1.243

30256  5 Oc11     Wood  164.783051 3.682

41463  5 Oc19     Wood   23.332800 3.120

31829  3 Oc11     Wood  112.339650 2.628

11076  3 Oc32     Wood  270.922800 1.244

20353  5 Oc11     Wood   74.456400 6.367

30688  2 Oc22    Steel  151.500400 2.950

31118  3 Oc11     Wood  106.786401 3.232

7938   3 Oc11     Wood  121.130100 2.223

35911  1 Oc11  Masonry   15.574700 1.523

51553  5 Oc11     Wood  101.935799 3.991

8429   2 Oc11     Wood   78.870399 2.336

30658  3 Oc19     Wood    7.628100 3.488

35621  1 Oc11     Wood   68.351600 1.884

32819  1 Oc12     Wood   81.169299 0.988

21750  5 Oc11     Wood   13.560199 6.293

33110  1 Oc11     Wood  137.288199 0.949

16804  5 Oc19    Steel   94.925000 5.424

10766  2 Oc11     Wood  110.352050 1.364

33043  1 Oc11  Masonry  108.804000 1.566

2525   1 Oc11     Wood  103.651900 2.775

50546  5 Oc19       NA    3.624000 4.055

10907  2 Oc11     Wood  172.653550 1.668

33379  3 Oc11     Wood   58.839049 3.677

48738  3 Oc11     Wood   92.931500 3.133

45818  2 Oc41       NA   38.355550 3.243

11172  2 Oc11     Wood  107.776200 0.245

40021  3 Oc11       NA    6.439400 3.143

45784  2 Oc19     Wood    9.796599 2.837

13301  5 Oc29  Masonry  231.604100 6.087

52666  5 Oc39     Wood  150.817901 3.632

16043  2 Oc22     Wood   50.981850 2.047

32931  1 Oc11     Wood   78.446501 0.935

24495  1 Oc12     Wood  134.953350 1.272

6006   5 Oc11     Wood  102.931801 2.768

15849  3 Oc11     Wood   80.187700 3.168

16116  2 Oc11     Wood   66.488600 2.763

36393  3 Oc11     Wood   82.420400 2.452

18041  3 Oc11     Wood  110.072900 2.658

36759  5 Oc19     Wood   46.591250 3.892

47427  1 Oc19       NA   18.062000 1.726

26659  1 Oc11     Wood  103.383900 1.648

54503  5 Oc19     Wood    6.632950 5.672

18346  3 Oc19     Wood   16.242450 1.377

43181  1 Oc19       NA   13.249600 1.514

16749  5 Oc13     Wood   29.878150 6.702

10509  2 Oc11     Wood   93.246150 1.560

12470  2 Oc11     Wood   93.381800 2.175

22514  5 Oc22  Masonry  119.784100 7.350

26684  1 Oc11     Wood  171.935201 1.530

47024  2 Oc11     Wood   37.760099 2.765

47549  1 Oc14     Wood   88.233800 1.539

14542  2 Oc19     Wood  112.179151 2.613

14548  2 Oc11     Wood  112.626950 2.386

44712  2 Oc19       NA    4.881700 2.101

54292  5 Oc19       NA    6.387600 7.305

42465  3 Oc19       NA    8.382800 0.071

50619  5 Oc19       NA   22.139551 4.082

18801  5 Oc11     Wood   79.048600 6.592

26907  5 Oc21    Steel  179.362801 4.118

44647  2 Oc19       NA    9.710499 1.523

53884  5   NA       NA    4.031301 5.733

17643  3 Oc19    Steel   53.442200 1.726

43555  1 Oc19     Wood   34.725400 2.031

50096  5 Oc19     Wood   11.685301 3.568

28338  3 Oc11     Wood  188.588949 3.547

14567  2 Oc11     Wood  102.271749 2.432

35229  3 Oc19     Wood  105.644650 2.907

54897  5 Oc39       NA   20.005850 3.392

43850  2 Oc19       NA    6.962800 0.618

23579  1 Oc11     Wood   21.967049 0.964

3911   5 Oc39    Steel  205.837100 5.655

11479  2 Oc11     Wood   99.143149 1.978

54780  5 Oc52       NA   10.819650 5.948

22294  5 Oc11     Wood   53.430601 6.842

49024  2 Oc19       NA    4.879450 1.353

20718  5 Oc11     Wood  105.222002 5.300

26194  1 Oc12     Wood   84.928300 0.503

3367   1 Oc11     Wood   88.040298 0.968

1739   2 Oc11     Wood  117.838700 2.573

38747  3 Oc29     Wood   79.019850 1.060

39564  2 Oc19       NA    4.477000 2.177

30646  3 Oc11     Wood  122.447250 3.557

41903  5 Oc29     Wood   86.908001 2.610

16245  5 Oc11     Wood   61.719000 5.410

50614  5 Oc19       NA   11.426900 3.941

24830  5 Oc11     Wood  129.197750 3.395

18775  5 Oc11     Wood  136.926350 6.070

41319  3 Oc19     Wood   76.514249 2.438

23014  4 Oc31    Steel 1989.326200 5.873

12580  2 Oc22       RC   58.098150 2.269

39381  1 Oc19       NA    5.029000 2.265

48634  3 Oc19       NA   11.585400 2.322

15812  3 Oc41     Wood  462.183200 2.932

38651  5 Oc31     Wood   83.293699 6.317

49498  3 Oc21     Wood  120.639800 3.052

10668  2 Oc11     Wood   66.690701 1.880

40389  3 Oc11     Wood    8.225700 2.602

24463  1 Oc11     Wood   11.705949 2.075

55092  5 Oc39       NA   11.127200 3.390

34442  1 Oc12       RC  188.031750 1.534

28174  3 Oc11  Masonry  147.856200 3.638

4554   5 Oc13     Wood  122.192000 3.760

22177  5 Oc31    Steel 1224.195600 6.403

41914  5 Oc19       NA    5.653600 3.068

3523   1 Oc11     Wood  138.554900 1.755

25453  5 Oc12     Wood  158.640450 3.945

54450  5 Oc11       NA    9.816400 7.402

33577  3 Oc11     Wood  165.150250 3.268

28060  5 Oc11     Wood  114.928550 3.331

28721  1 Oc11     Wood  103.077350 1.638

38783  1 Oc19       NA   10.094450 0.857

14335  3 Oc11     Wood   70.515600 2.488

44932  3 Oc29       NA    5.967300 2.172

37656  2 Oc41       RC   31.681150 2.986

33687  3 Oc39    Steel 1162.853150 3.072

19868  5 Oc11     Wood   66.196449 6.158

17699  3 Oc11     Wood   39.427450 2.587

5373   5 Oc12     Wood  110.626501 3.108

35351  1 Oc19     Wood   80.164500 2.255

19036  2 Oc52    Steel  285.649800 5.023

 



More information about the R-help mailing list