How to calculate fractal dimension by fitting on a log-log plot?

I have simulated a DLA pattern by MC method and the data is for fractal dimension. The right column is the number of particle N(r) into radius r and the left column is the radius r. I plotted a log-log plot by Origin software. But I have a problem with fitting onto the plot. I do not know which part of the data should be considered and others should be deleted to fit on the log-log plot accurately and show me a correct fractal dimension. Please guide me to do it. In fact, I should consider a scaling region for calculating the slope (fractal dimension) but I do not know how I do it.

The result is below:

Two circles show two regions which should be considered accurately.

My data is shown below:

      r N(r)
0 1
1 8
2 17
3 24
4 35
5 47
6 61
7 75
8 95
9 116
10    136
11    156
12    175
13    204
14    236
15    265
16    289
17    312
18    343
19    369
20    392
21    418
22    450
23    479
24    502
25    536
26    575
27    609
28    646
29    684
30    721
31    757
32    794
33    837
34    883
35    923
36    978
37    1018
38    1054
39    1107
40    1151
41    1204
42    1247
43    1303
44    1360
45    1416
46    1476
47    1523
48    1573
49    1621
50    1666
51    1715
52    1749
53    1785
54    1831
55    1896
56    1950
57    2019
58    2071
59    2130
60    2177
61    2236
62    2304
63    2349
64    2403
65    2477
66    2542
67    2610
68    2680
69    2738
70    2811
71    2882
72    2946
73    3027
74    3111
75    3198
76    3288
77    3384
78    3474
79    3573
80    3660
81    3732
82    3818
83    3886
84    3979
85    4061
86    4129
87    4211
88    4284
89    4385
90    4470
91    4538
92    4614
93    4689
94    4762
95    4832
96    4921
97    5007
98    5097
99    5193
100   5284
101   5369
102   5470
103   5565
104   5660
105   5755
106   5853
107   5959
108   6052
109   6159
110   6263
111   6376
112   6503
113   6611
114   6719
115   6809
116   6893
117   7001
118   7112
119   7225
120   7335
121   7434
122   7580
123   7734
124   7868
125   7991
126   8117
127   8245
128   8383
129   8520
130   8670
131   8785
132   8914
133   9041
134   9171
135   9297
136   9429
137   9557
138   9675
139   9803
140   9929
141   10037
142   10143
143   10274
144   10429
145   10549
146   10659
147   10766
148   10873
149   10978
150   11086
151   11196
152   11315
153   11445
154   11559
155   11681
156   11815
157   11947
158   12081
159   12218
160   12370
161   12536
162   12669
163   12812
164   12941
165   13061
166   13176
167   13307
168   13433
169   13566
170   13689
171   13812
172   13935
173   14052
174   14167
175   14256
176   14348
177   14453
178   14561
179   14676
180   14768
181   14840
182   14915
183   14995
184   15065
185   15139
186   15195
187   15253
188   15325
189   15404
190   15489
191   15570
192   15649
193   15745
194   15835
195   15940
196   16038
197   16146
198   16248
199   16356
200   16483
201   16570
202   16650
203   16747
204   16847
205   16955
206   17046
207   17152
208   17252
209   17353
210   17441
211   17542
212   17627
213   17725
214   17804
215   17893
216   17983
217   18079
218   18161
219   18240
220   18343
221   18440
222   18546
223   18644
224   18729
225   18821
226   18921
227   19008
228   19090
229   19179
230   19260
231   19328
232   19404
233   19491
234   19575
235   19647
236   19728
237   19786
238   19861
239   19939
240   20016
241   20089
242   20161
243   20233
244   20295
245   20378
246   20450
247   20515
248   20619
249   20692
250   20780
251   20846
252   20925
253   20982
254   21041
255   21102
256   21151
257   21206
258   21263
259   21334
260   21383
261   21434
262   21498
263   21570
264   21670
265   21769
266   21846
267   21907
268   21973
269   22047
270   22113
271   22178
272   22232
273   22278
274   22307
275   22339
276   22387
277   22432
278   22497
279   22555
280   22616
281   22680
282   22728
283   22775
284   22822
285   22856
286   22886
287   22925
288   22961
289   23004
290   23045
291   23093
292   23128
293   23185
294   23239
295   23283
296   23330
297   23373
298   23415
299   23452
300   23481
301   23528
302   23576
303   23627
304   23671
305   23705
306   23735
307   23771
308   23825
309   23871
310   23910
311   23954
312   23994
313   24033
314   24066
315   24093
316   24126
317   24156
318   24201
319   24227
320   24249
321   24277
322   24290
323   24309
324   24357
325   24402
326   24450
327   24483
328   24514
329   24536
330   24574
331   24605
332   24625
333   24655
334   24684
335   24701
336   24725
337   24747
338   24761
339   24784
340   24809
341   24830
342   24852
343   24870
344   24891
345   24906
346   24917
347   24931
348   24945
349   24959
350   24971
351   24982
352   24990
353   24993
354   24995
355   24999
356   25000
357   25001
358   25001
359   25001
360   25001
361   25001
362   25001
363   25001
364   25001
365   25001
366   25001
367   25001
368   25001
369   25001
370   25001
371   25001
372   25001
373   25001
374   25001
375   25001
376   25001
377   25001
378   25001
379   25001
380   25001
381   25001
382   25001
383   25001
384   25001
385   25001
386   25001
387   25001
388   25001
389   25001
390   25001
391   25001
392   25001
393   25001
394   25001
395   25001
396   25001
397   25001
398   25001
399   25001
400   25001
401   25001
402   25001
403   25001
404   25001
405   25001
406   25001
407   25001
408   25001
409   25001
410   25001
411   25001
412   25001
413   25001
414   25001
415   25001
416   25001
417   25001
418   25001
419   25001
420   25001
421   25001
422   25001
423   25001
424   25001
425   25001
426   25001
427   25001
428   25001
429   25001
430   25001
431   25001
432   25001
433   25001
434   25001
435   25001
436   25001
437   25001
438   25001
439   25001
440   25001
441   25001
442   25001
443   25001
444   25001
445   25001
446   25001
447   25001
448   25001
449   25001
450   25001
451   25001
452   25001
453   25001
454   25001
455   25001
456   25001
457   25001
458   25001
459   25001
460   25001
461   25001
462   25001
463   25001
464   25001
465   25001
466   25001
467   25001
468   25001
469   25001
470   25001
471   25001
472   25001
473   25001
474   25001
475   25001
476   25001
477   25001
478   25001
479   25001
480   25001
481   25001
482   25001
483   25001
484   25001
485   25001
486   25001
487   25001
488   25001
489   25001
490   25001
491   25001
492   25001
493   25001
494   25001
495   25001
496   25001
497   25001
498   25001
499   25001
500   25001
501   25001
502   25001
503   25001
504   25001
505   25001
506   25001
507   25001
508   25001
509   25001
510   25001
511   25001
512   25001
513   25001
514   25001
515   25001
516   25001
517   25001
518   25001
519   25001
520   25001
521   25001
522   25001
523   25001
524   25001
525   25001
526   25001
527   25001
528   25001
529   25001
530   25001
531   25001
532   25001
533   25001
534   25001
535   25001
536   25001
537   25001
538   25001
539   25001
540   25001
541   25001
542   25001
543   25001
544   25001
545   25001
546   25001
547   25001
548   25001
549   25001
550   25001
551   25001
552   25001
553   25001
554   25001
555   25001
556   25001
557   25001
558   25001
559   25001
560   25001
561   25001
562   25001
563   25001
564   25001
565   25001
566   25001
567   25001
568   25001
569   25001
570   25001
571   25001
572   25001
573   25001
574   25001
575   25001
576   25001
577   25001
578   25001
579   25001
580   25001
581   25001
582   25001
583   25001
584   25001
585   25001
586   25001
587   25001
588   25001
589   25001
590   25001
591   25001
592   25001
593   25001
594   25001
595   25001
596   25001
597   25001
598   25001
599   25001
600   25001
601   25001
602   25001
603   25001
604   25001
605   25001
606   25001
607   25001
608   25001
609   25001
610   25001
611   25001
612   25001
613   25001
614   25001
615   25001
616   25001
617   25001
618   25001
619   25001
620   25001
621   25001
622   25001
623   25001
624   25001
625   25001
626   25001
627   25001
628   25001
629   25001
630   25001
631   25001
632   25001
633   25001
634   25001
635   25001
636   25001
637   25001
638   25001
639   25001
640   25001
641   25001
642   25001
643   25001
644   25001
645   25001
646   25001
647   25001
648   25001
649   25001
650   25001
651   25001
652   25001
653   25001
654   25001
655   25001
656   25001
657   25001
658   25001
659   25001
660   25001
661   25001
662   25001
663   25001
664   25001
665   25001
666   25001
667   25001
668   25001
669   25001
670   25001
671   25001
672   25001
673   25001
674   25001
675   25001
676   25001
677   25001
678   25001
679   25001
680   25001
681   25001
682   25001
683   25001
684   25001
685   25001
686   25001
687   25001
688   25001
689   25001
690   25001
691   25001
692   25001
693   25001
694   25001
695   25001
696   25001
697   25001
698   25001
699   25001
700   25001
701   25001
702   25001
703   25001
704   25001
705   25001
706   25001
707   25001
708   25001
709   25001
710   25001
711   25001
712   25001
713   25001
714   25001
715   25001
716   25001
717   25001
718   25001
719   25001
720   25001
721   25001
722   25001
723   25001
724   25001
725   25001
726   25001
727   25001
728   25001
729   25001
730   25001
731   25001
732   25001
733   25001
734   25001
735   25001
736   25001
737   25001
738   25001
739   25001
740   25001
741   25001
742   25001
743   25001
744   25001
745   25001
746   25001
747   25001
748   25001
749   25001
750   25001
751   25001
752   25001
753   25001
754   25001
755   25001
756   25001
757   25001
758   25001
759   25001
760   25001
761   25001
762   25001
763   25001
764   25001
765   25001
766   25001
767   25001
768   25001
769   25001
770   25001
771   25001
772   25001
773   25001
774   25001
775   25001
776   25001
777   25001
778   25001
779   25001
780   25001
781   25001
782   25001
783   25001
784   25001
785   25001
786   25001
787   25001
788   25001
789   25001
790   25001
791   25001
792   25001
793   25001
794   25001
795   25001
796   25001
797   25001
798   25001
799   25001
800   25001
801   25001
802   25001
803   25001
804   25001
805   25001
806   25001
807   25001
808   25001
809   25001
810   25001
811   25001
812   25001
813   25001
814   25001
815   25001
816   25001
817   25001
818   25001
819   25001
820   25001
821   25001
822   25001
823   25001
824   25001
825   25001
826   25001
827   25001
828   25001
829   25001
830   25001
831   25001
832   25001
833   25001
834   25001
835   25001
836   25001
837   25001
838   25001
839   25001
840   25001
841   25001
842   25001
843   25001
844   25001
845   25001
846   25001
847   25001
848   25001
849   25001
850   25001
851   25001
852   25001
853   25001
854   25001
855   25001
856   25001
857   25001
858   25001
859   25001
860   25001
861   25001
862   25001
863   25001
864   25001
865   25001
866   25001
867   25001
868   25001
869   25001
870   25001
871   25001
872   25001
873   25001
874   25001
875   25001
876   25001
877   25001
878   25001
879   25001
880   25001
881   25001
882   25001
883   25001
884   25001
885   25001
886   25001
887   25001
888   25001
889   25001
890   25001
891   25001
892   25001
893   25001
894   25001
895   25001
896   25001
897   25001
898   25001
899   25001
900   25001
901   25001
902   25001
903   25001
904   25001
905   25001
906   25001
907   25001
908   25001
909   25001
910   25001
911   25001
912   25001
913   25001
914   25001
915   25001
916   25001
917   25001
918   25001
919   25001
920   25001
921   25001
922   25001
923   25001
924   25001
925   25001
926   25001
927   25001
928   25001
929   25001
930   25001
931   25001
932   25001
933   25001
934   25001
935   25001
936   25001
937   25001
938   25001
939   25001
940   25001
941   25001
942   25001
943   25001
944   25001
945   25001
946   25001
947   25001
948   25001
949   25001
950   25001
951   25001
952   25001
953   25001
954   25001
955   25001
956   25001
957   25001
958   25001
959   25001
960   25001
961   25001
962   25001
963   25001
964   25001
965   25001
966   25001
967   25001
968   25001
969   25001
970   25001
971   25001
972   25001
973   25001
974   25001
975   25001
976   25001
977   25001
978   25001
979   25001
980   25001
981   25001
982   25001
983   25001
984   25001
985   25001
986   25001
987   25001
988   25001
989   25001
990   25001
991   25001
992   25001
993   25001
994   25001
995   25001
996   25001
997   25001
998   25001
999   25001
1000  25001
1001  25001
1002  25001
1003  25001
1004  25001
1005  25001
1006  25001
1007  25001
1008  25001
1009  25001
1010  25001
1011  25001
1012  25001
1013  25001
1014  25001
1015  25001
1016  25001
1017  25001
1018  25001
1019  25001
1020  25001
1021  25001
1022  25001
1023  25001

• What does the data denote? There are different ways of calculating fractal dimensions (box counting seems likely here). Also, how do you know if you have the "correct" fractal dimension? Please refine your question and show what you are trying to do. – Anders Sandberg Jun 6 at 22:51
• It is often (though not absolutely always) the case that the fitting problem is formally independent of the physics. That is, getting fit parameters out of a log-log plot is a problem that comes up over and over again and the way you do it has nothing to do with the fact that the data arose int he context of trying to learn something about fractal dimension. – dmckee Jun 7 at 23:04
• @AndersSandberg Thank you for your response. Actually, I have simulated a DLA pattern by MC method and the data is for fractal dimension. The left column is the number of particle N(r) into radius r and the right column is the radius r. I plotted a log-log plot by Origin software. But I have a problem with fitting onto the plot. In fact, I should consider a scaling region for calculating the slope (fractal dimension) but I do not know how I do it. – Alireza Alipour Jun 8 at 6:55

The value you plotted onto the fit is the one you are interested in.

Note that you are computing a quantity different from the box-dimension, which is the quantity generally used for these estimates.

The box dimension is defined as:

$$d_B=lim_{\epsilon\rightarrow0}\frac{log\;N(\epsilon)}{log\;(\frac{1}{\epsilon})}$$ While you are using the quantity: $$d=\frac{log\;N(R)}{log\;R}$$. If you substitute $$\epsilon$$ with $$R^{-1}$$ in the definition of box dimension then, in the limit of $$R\rightarrow\infty$$ you obtain the same value, so that you can interchange the two estimates whenever $$R$$ is large enough, say so large that only a negligible set of your particles are distant less than $$R^{-1}$$.

This said, let's come to the plot.

On the rightmost part, is obvious that you are considering values of $$R$$ for which you are encircling almost all of your particles, so you should discard your data.

On the leftmost side, on the other hand, you have a sort of offset in your dimension which is most likely due to making your estimate on a local cluster of particles. At this stage this part of the data is not to be considered either.

In order to understand which data to discard on the left side you should:

• check that the particles are almost all at distances larger than $$R_{min}^{-1}$$ from each others;

• average the estimate around your distribution of particles for the smaller values of the radius;

This last step will give you some error bars to put on the data and probably will also reduce the offset you are seeing on the left side of your graph. Be careful to implement this averaging without including (almost empty) balls on the edge of your distribution, because these would ruin your estimate.

Edit: looking at the numbers I realize that probably most of your data are not in the range that makes your quantity equivalent to the box dimension. However I would say that the quantity you are considering may have a dignity of its own as scaling dimension. I don't know how much this can be similar to other estimates of fractal dimension, like the box dimension or the Haussdorff dimension.

You could make a separate fit for the region in which $$R$$ is so large that (almost) all the particles are at distances larger than $$R^{-1}$$ and see the difference between the results.

• Thank you so much for your response. I have made a mistake on my data and corrected it. In fact, The right column is the number of particle N(r) into radius r and the left column is the radius r. But about your answer, I should be mention that the main answer for solving the problem is to find R min and R max. After that, we can fit over the plot in the scaling region (R min < R < R max). Is there a way to find the region from the data? (size of particles equals to lattice constant (unit) and size of the square lattice is 1024 * 1024) – Alireza Alipour Jun 9 at 8:28
• yeah basically when $N_{tot} - N(R) < N(R) - N(R_{previous})$ you approximately have reached $R_{max}$ (where the subscript previous indicates the R used for the before last estimate), while when $\sqrt{\pi R^2/N(R)}>1/R$ you are at sufficiently large values of $R$ (the left hand side is a very rough estimate of the distance between the particles). To have the correct estimate of you R min you should compute the distribution of the distance between nearest particles and use 1/R< dmin, where you take dmin to be a distance so small that say 95% of your particles have their nearest neighbour – AoZora Jun 9 at 13:32
• * nearest neighbour at a larger distance than dmin. Sorry for the format but I can't do better right now – AoZora Jun 9 at 13:35
• Thank you so much for your answers. I want to find R min and R max on above data and based on your explanation, actually, I did not understand to find it. Would you mind helping me to find an exact number for R min and R max on above data? – Alireza Alipour Jun 10 at 6:28
• sorry but I have no time to do that. Let me explain a bit more precisely two things: basically the $R_{max}$ will be where the (approximatively) linear growth of $log\;N(R)$ stops, the formula I gave you is just a way to extract that computationally. To find the $R_{min}$ you can first use the inequality with pi and square root, that is a good approximation if your distribution of particles does not have too many inhomogeneities. If it does you need to estimate the shortest distance of separation between the particles. – AoZora Jun 10 at 6:50