Hello,
I entered data by using the INPUT command. After that the variables have
been converted to matrices (MKMAT command). When I look at the output
(MATRIX LIST) I notice some kind of inaccuracy, e.g. the original value of
1.06 is given back as 1.0599999.
I have attached the log-file in order to make the error reproducible for
everybody. As I cannot explain the inaccuracy, I wonder if I use the INPUT
command in a wrong way.
Thank you for your assistance.
Christoph
log-file:
----------------------------------------------------------------------------
---
log: d:\docs\inputmat.log
log type: text
opened on: 5 May 2004, 18:28:01
. do "C:\DOKUME~1\ba6sp12\LOKALE~1\Temp\STD000000.tmp"
. * data (manual input)
. input x y
x y
1. 1 2
2. 1.01 2.01
3. 1.02 2.02
4. 1.03 2.03
5. 1.04 2.04
6. 1.05 2.05
7. 1.06 2.06
8. 1.07 2.07
9. 1.08 2.08
10. 1.09 2.09
11. 1.1 2.1
12. 1.11 2.11
13. 1.12 2.12
14. 1.13 2.13
15. 1.14 2.14
16. 1.15 2.15
17. 1.16 2.16
18. 1.17 2.17
19. 1.18 2.18
20. 1.19 2.19
21. 1.2 2.2
22. 1.21 2.21
23. 1.22 2.22
24. 1.23 2.23
25. 1.24 2.24
26. 1.25 2.25
27. 1.26 2.26
28. 1.27 2.27
29. 1.28 2.28
30. 1.29 2.29
31. 1.3 2.3
32. 1.31 2.31
33. 1.32 2.32
34. 1.33 2.33
35. 1.34 2.34
36. 1.35 2.35
37. 1.36 2.36
38. 1.37 2.37
39. 1.38 2.38
40. 1.39 2.39
41. 1.4 2.4
42. 1.41 2.41
43. 1.42 2.42
44. 1.43 2.43
45. 1.44 2.44
46. 1.45 2.45
47. 1.46 2.46
48. 1.47 2.47
49. 1.48 2.48
50. 1.49 2.49
51. 1.5 2.5
52. 1.51 2.51
53. 1.52 2.52
54. 1.53 2.53
55. 1.54 2.54
56. 1.55 2.55
57. 1.56 2.56
58. 1.57 2.57
59. 1.58 2.58
60. 1.59 2.59
61. 1.6 2.6
62. 1.61 2.61
63. 1.62 2.62
64. 1.63 2.63
65. 1.64 2.64
66. 1.65 2.65
67. 1.66 2.66
68. 1.67 2.67
69. 1.68 2.68
70. 1.69 2.69
71. 1.7 2.7
72. 1.71 2.71
73. 1.72 2.72
74. 1.73 2.73
75. 1.74 2.74
76. 1.75 2.75
77. 1.76 2.76
78. 1.77 2.77
79. 1.78 2.78
80. 1.79 2.79
81. 1.8 2.8
82. 1.81 2.81
83. 1.82 2.82
84. 1.83 2.83
85. 1.84 2.84
86. 1.85 2.85
87. 1.86 2.86
88. 1.87 2.87
89. 1.88 2.88
90. 1.89 2.89
91. 1.9 2.9
92. 1.91 2.91
93. 1.92 2.92
94. 1.93 2.93
95. 1.94 2.94
96. 1.95 2.95
97. 1.96 2.96
98. 1.97 2.97
99. 1.98 2.98
100. 1.99 2.99
101. 2 3
102. end
.
. *convert to matrices
. mkmat x y, matrix(a)
. mkmat x, matrix(x)
. mkmat y, matrix(y)
.
. *operation
. matrix z=y-x
.
. *view output
. matrix list a
a[101,2]
x y
r1 1 2
r2 1.01 2.01
r3 1.02 2.02
r4 1.03 2.03
r5 1.04 2.04
r6 1.05 2.05
r7 1.0599999 2.0599999
r8 1.0700001 2.0699999
r9 1.08 2.0799999
r10 1.09 2.0899999
r11 1.1 2.0999999
r12 1.11 2.1099999
r13 1.12 2.1199999
r14 1.13 2.1300001
r15 1.14 2.1400001
r16 1.15 2.1500001
r17 1.16 2.1600001
r18 1.17 2.1700001
r19 1.1799999 2.1800001
r20 1.1900001 2.1900001
r21 1.2 2.2
r22 1.21 2.21
r23 1.22 2.22
r24 1.23 2.23
r25 1.24 2.24
r26 1.25 2.25
r27 1.26 2.26
r28 1.27 2.27
r29 1.28 2.28
r30 1.29 2.29
r31 1.3 2.3
r32 1.3099999 2.3099999
r33 1.3200001 2.3199999
r34 1.33 2.3299999
r35 1.34 2.3399999
r36 1.35 2.3499999
r37 1.36 2.3599999
r38 1.37 2.3699999
r39 1.38 2.3800001
r40 1.39 2.3900001
r41 1.4 2.4000001
r42 1.41 2.4100001
r43 1.42 2.4200001
r44 1.4299999 2.4300001
r45 1.4400001 2.4400001
r46 1.45 2.45
r47 1.46 2.46
r48 1.47 2.47
r49 1.48 2.48
r50 1.49 2.49
r51 1.5 2.5
r52 1.51 2.51
r53 1.52 2.52
r54 1.53 2.53
r55 1.54 2.54
r56 1.55 2.55
r57 1.5599999 2.5599999
r58 1.5700001 2.5699999
r59 1.58 2.5799999
r60 1.59 2.5899999
r61 1.6 2.5999999
r62 1.61 2.6099999
r63 1.62 2.6199999
r64 1.63 2.6300001
r65 1.64 2.6400001
r66 1.65 2.6500001
r67 1.66 2.6600001
r68 1.67 2.6700001
r69 1.6799999 2.6800001
r70 1.6900001 2.6900001
r71 1.7 2.7
r72 1.71 2.71
r73 1.72 2.72
r74 1.73 2.73
r75 1.74 2.74
r76 1.75 2.75
r77 1.76 2.76
r78 1.77 2.77
r79 1.78 2.78
r80 1.79 2.79
r81 1.8 2.8
r82 1.8099999 2.8099999
r83 1.8200001 2.8199999
r84 1.83 2.8299999
r85 1.84 2.8399999
r86 1.85 2.8499999
r87 1.86 2.8599999
r88 1.87 2.8699999
r89 1.88 2.8800001
r90 1.89 2.8900001
r91 1.9 2.9000001
r92 1.91 2.9100001
r93 1.92 2.9200001
r94 1.9299999 2.9300001
r95 1.9400001 2.9400001
r96 1.95 2.95
r97 1.96 2.96
r98 1.97 2.97
r99 1.98 2.98
r100 1.99 2.99
r101 2 3
. matrix list z
z[101,1]
x
r1 1
r2 1
r3 1
r4 1
r5 1
r6 1
r7 1
r8 .99999988
r9 .99999988
r10 .99999988
r11 .99999988
r12 .99999988
r13 .99999988
r14 1.0000001
r15 1.0000001
r16 1.0000001
r17 1.0000001
r18 1.0000001
r19 1.0000001
r20 1
r21 1
r22 1
r23 1
r24 1
r25 1
r26 1
r27 1
r28 1
r29 1
r30 1
r31 1
r32 1
r33 .99999988
r34 .99999988
r35 .99999988
r36 .99999988
r37 .99999988
r38 .99999988
r39 1.0000001
r40 1.0000001
r41 1.0000001
r42 1.0000001
r43 1.0000001
r44 1.0000001
r45 1
r46 1
r47 1
r48 1
r49 1
r50 1
r51 1
r52 1
r53 1
r54 1
r55 1
r56 1
r57 1
r58 .99999988
r59 .99999988
r60 .99999988
r61 .99999988
r62 .99999988
r63 .99999988
r64 1.0000001
r65 1.0000001
r66 1.0000001
r67 1.0000001
r68 1.0000001
r69 1.0000001
r70 1
r71 1
r72 1
r73 1
r74 1
r75 1
r76 1
r77 1
r78 1
r79 1
r80 1
r81 1
r82 1
r83 .99999988
r84 .99999988
r85 .99999988
r86 .99999988
r87 .99999988
r88 .99999988
r89 1.0000001
r90 1.0000001
r91 1.0000001
r92 1.0000001
r93 1.0000001
r94 1.0000001
r95 1
r96 1
r97 1
r98 1
r99 1
r100 1
r101 1
.
end of do-file
. log close
log: d:\docs\inputmat.log
log type: text
closed on: 5 May 2004, 18:28:28
----------------------------------------------------------------------------
---
Christoph Wunder, Diplom-Volkswirt
Otto-Friedrich-Universit�t Bamberg
Professur f�r VWL, insb. Sozialpolitik
Feldkirchenstrasse 21
96045 Bamberg Germany
phone: ++49-951-8632601 (2569)
e-mail: [email protected]
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/