Analysis of ISAF casualties

input data

makedatelist[string_] :=
Module[{cuts},
cuts = Union[Flatten[StringPosition[string,"/"]]];
{ToExpression[StringJoin["20",StringDrop[string,Last[cuts]]]],
ToExpression[StringTake[string,{1,First[cuts]-1}]],
ToExpression[StringTake[string,{First[cuts]+1,Last[cuts]-1}]]
}
];

casualties = 
Import[
"/Users/dmeyer/Projects/ONR/AsymmetricExplosiveThreats/2009/papers/redqueen/Afghanistan/Badghis.csv"
];
datestrings = First[Transpose[casualties]];
Badghisdates = Table[makedatelist[datestrings[[i]]],{i,1,Length[datestrings]}];

casualties = 
Import[
"/Users/dmeyer/Projects/ONR/AsymmetricExplosiveThreats/2009/papers/redqueen/Afghanistan/Baghlan.csv"
];
datestrings = First[Transpose[casualties]];
Baghlandates = Table[makedatelist[datestrings[[i]]],{i,1,Length[datestrings]}];

casualties = 
Import[
"/Users/dmeyer/Projects/ONR/AsymmetricExplosiveThreats/2009/papers/redqueen/Afghanistan/Balkh.csv"
];
datestrings = First[Transpose[casualties]];
Balkhdates = Table[makedatelist[datestrings[[i]]],{i,1,Length[datestrings]}];

casualties = 
Import[
"/Users/dmeyer/Projects/ONR/AsymmetricExplosiveThreats/2009/papers/redqueen/Afghanistan/Bamyan.csv"
];
datestrings = First[Transpose[casualties]];
Bamyandates = Table[makedatelist[datestrings[[i]]],{i,1,Length[datestrings]}];

casualties = 
Import[
"/Users/dmeyer/Projects/ONR/AsymmetricExplosiveThreats/2009/papers/redqueen/Afghanistan/EasternAfghanistan.csv"
];
datestrings = First[Transpose[casualties]];
EasternAfghanistandates = Table[makedatelist[datestrings[[i]]],{i,1,Length[datestrings]}];

casualties = 
Import[
"/Users/dmeyer/Projects/ONR/AsymmetricExplosiveThreats/2009/papers/redqueen/Afghanistan/Farah.csv"
];
datestrings = First[Transpose[casualties]];
Farahdates = Table[makedatelist[datestrings[[i]]],{i,1,Length[datestrings]}];

casualties = 
Import[
"/Users/dmeyer/Projects/ONR/AsymmetricExplosiveThreats/2009/papers/redqueen/Afghanistan/Faryab.csv"
];
datestrings = First[Transpose[casualties]];
Faryabdates = Table[makedatelist[datestrings[[i]]],{i,1,Length[datestrings]}];

casualties = 
Import[
"/Users/dmeyer/Projects/ONR/AsymmetricExplosiveThreats/2009/papers/redqueen/Afghanistan/Ghazni.csv"
];
datestrings = First[Transpose[casualties]];
Ghaznidates = Table[makedatelist[datestrings[[i]]],{i,1,Length[datestrings]}];

casualties = 
Import[
"/Users/dmeyer/Projects/ONR/AsymmetricExplosiveThreats/2009/papers/redqueen/Afghanistan/Ghowr.csv"
];
datestrings = First[Transpose[casualties]];
Ghowrdates = Table[makedatelist[datestrings[[i]]],{i,1,Length[datestrings]}];

casualties = 
Import[
"/Users/dmeyer/Projects/ONR/AsymmetricExplosiveThreats/2009/papers/redqueen/Afghanistan/Helmand.csv"
];
datestrings = First[Transpose[casualties]];
Helmanddates = Table[makedatelist[datestrings[[i]]],{i,1,Length[datestrings]}];

casualties = 
Import[
"/Users/dmeyer/Projects/ONR/AsymmetricExplosiveThreats/2009/papers/redqueen/Afghanistan/Herat.csv"
];
datestrings = First[Transpose[casualties]];
Heratdates = Table[makedatelist[datestrings[[i]]],{i,1,Length[datestrings]}];

casualties = 
Import[
"/Users/dmeyer/Projects/ONR/AsymmetricExplosiveThreats/2009/papers/redqueen/Afghanistan/Jowzjan.csv"
];
datestrings = First[Transpose[casualties]];
Jowzjandates = Table[makedatelist[datestrings[[i]]],{i,1,Length[datestrings]}];

casualties = 
Import[
"/Users/dmeyer/Projects/ONR/AsymmetricExplosiveThreats/2009/papers/redqueen/Afghanistan/Kabul.csv"
];
datestrings = First[Transpose[casualties]];
Kabuldates = Table[makedatelist[datestrings[[i]]],{i,1,Length[datestrings]}];

casualties = 
Import[
"/Users/dmeyer/Projects/ONR/AsymmetricExplosiveThreats/2009/papers/redqueen/Afghanistan/Kandahar.csv"
];
datestrings = First[Transpose[casualties]];
Kandahardates = Table[makedatelist[datestrings[[i]]],{i,1,Length[datestrings]}];

casualties = 
Import[
"/Users/dmeyer/Projects/ONR/AsymmetricExplosiveThreats/2009/papers/redqueen/Afghanistan/Kapisa.csv"
];
datestrings = First[Transpose[casualties]];
Kapisadates = Table[makedatelist[datestrings[[i]]],{i,1,Length[datestrings]}];

casualties = 
Import[
"/Users/dmeyer/Projects/ONR/AsymmetricExplosiveThreats/2009/papers/redqueen/Afghanistan/Khowst.csv"
];
datestrings = First[Transpose[casualties]];
Khowstdates = Table[makedatelist[datestrings[[i]]],{i,1,Length[datestrings]}];

casualties = 
Import[
"/Users/dmeyer/Projects/ONR/AsymmetricExplosiveThreats/2009/papers/redqueen/Afghanistan/Kunar.csv"
];
datestrings = First[Transpose[casualties]];
Kunardates = Table[makedatelist[datestrings[[i]]],{i,1,Length[datestrings]}];

casualties = 
Import[
"/Users/dmeyer/Projects/ONR/AsymmetricExplosiveThreats/2009/papers/redqueen/Afghanistan/Kunduz.csv"
];
datestrings = First[Transpose[casualties]];
Kunduzdates = Table[makedatelist[datestrings[[i]]],{i,1,Length[datestrings]}];

casualties = 
Import[
"/Users/dmeyer/Projects/ONR/AsymmetricExplosiveThreats/2009/papers/redqueen/Afghanistan/Laghman.csv"
];
datestrings = First[Transpose[casualties]];
Laghmandates = Table[makedatelist[datestrings[[i]]],{i,1,Length[datestrings]}];

casualties = 
Import[
"/Users/dmeyer/Projects/ONR/AsymmetricExplosiveThreats/2009/papers/redqueen/Afghanistan/Logar.csv"
];
datestrings = First[Transpose[casualties]];
Logardates = Table[makedatelist[datestrings[[i]]],{i,1,Length[datestrings]}];

casualties = 
Import[
"/Users/dmeyer/Projects/ONR/AsymmetricExplosiveThreats/2009/papers/redqueen/Afghanistan/NA.csv"
];
datestrings = First[Transpose[casualties]];
NAdates = Table[makedatelist[datestrings[[i]]],{i,1,Length[datestrings]}];

casualties = 
Import[
"/Users/dmeyer/Projects/ONR/AsymmetricExplosiveThreats/2009/papers/redqueen/Afghanistan/Nangarhar.csv"
];
datestrings = First[Transpose[casualties]];
Nangarhardates = Table[makedatelist[datestrings[[i]]],{i,1,Length[datestrings]}];

casualties = 
Import[
"/Users/dmeyer/Projects/ONR/AsymmetricExplosiveThreats/2009/papers/redqueen/Afghanistan/Nimroz.csv"
];
datestrings = First[Transpose[casualties]];
Nimrozdates = Table[makedatelist[datestrings[[i]]],{i,1,Length[datestrings]}];

casualties = 
Import[
"/Users/dmeyer/Projects/ONR/AsymmetricExplosiveThreats/2009/papers/redqueen/Afghanistan/Nuristan.csv"
];
datestrings = First[Transpose[casualties]];
Nuristandates = Table[makedatelist[datestrings[[i]]],{i,1,Length[datestrings]}];

casualties = 
Import[
"/Users/dmeyer/Projects/ONR/AsymmetricExplosiveThreats/2009/papers/redqueen/Afghanistan/Oruzgan.csv"
];
datestrings = First[Transpose[casualties]];
Oruzgandates = Table[makedatelist[datestrings[[i]]],{i,1,Length[datestrings]}];

casualties = 
Import[
"/Users/dmeyer/Projects/ONR/AsymmetricExplosiveThreats/2009/papers/redqueen/Afghanistan/Paktia.csv"
];
datestrings = First[Transpose[casualties]];
Paktiadates = Table[makedatelist[datestrings[[i]]],{i,1,Length[datestrings]}];

casualties = 
Import[
"/Users/dmeyer/Projects/ONR/AsymmetricExplosiveThreats/2009/papers/redqueen/Afghanistan/Paktika.csv"
];
datestrings = First[Transpose[casualties]];
Paktikadates = Table[makedatelist[datestrings[[i]]],{i,1,Length[datestrings]}];

casualties = 
Import[
"/Users/dmeyer/Projects/ONR/AsymmetricExplosiveThreats/2009/papers/redqueen/Afghanistan/Panjshir.csv"
];
datestrings = First[Transpose[casualties]];
Panjshirdates = Table[makedatelist[datestrings[[i]]],{i,1,Length[datestrings]}];

casualties = 
Import[
"/Users/dmeyer/Projects/ONR/AsymmetricExplosiveThreats/2009/papers/redqueen/Afghanistan/Parwan.csv"
];
datestrings = First[Transpose[casualties]];
Parwandates = Table[makedatelist[datestrings[[i]]],{i,1,Length[datestrings]}];

casualties = 
Import[
"/Users/dmeyer/Projects/ONR/AsymmetricExplosiveThreats/2009/papers/redqueen/Afghanistan/Samangan.csv"
];
datestrings = First[Transpose[casualties]];
Samangandates = Table[makedatelist[datestrings[[i]]],{i,1,Length[datestrings]}];

casualties = 
Import[
"/Users/dmeyer/Projects/ONR/AsymmetricExplosiveThreats/2009/papers/redqueen/Afghanistan/SouthernAfghanistan.csv"
];
datestrings = First[Transpose[casualties]];
SouthernAfghanistandates = Table[makedatelist[datestrings[[i]]],{i,1,Length[datestrings]}];

casualties = 
Import[
"/Users/dmeyer/Projects/ONR/AsymmetricExplosiveThreats/2009/papers/redqueen/Afghanistan/Takhar.csv"
];
datestrings = First[Transpose[casualties]];
Takhardates = Table[makedatelist[datestrings[[i]]],{i,1,Length[datestrings]}];

casualties = 
Import[
"/Users/dmeyer/Projects/ONR/AsymmetricExplosiveThreats/2009/papers/redqueen/Afghanistan/Unknown.csv"
];
datestrings = First[Transpose[casualties]];
Unknowndates = Table[makedatelist[datestrings[[i]]],{i,1,Length[datestrings]}];

casualties = 
Import[
"/Users/dmeyer/Projects/ONR/AsymmetricExplosiveThreats/2009/papers/redqueen/Afghanistan/Wardak.csv"
];
datestrings = First[Transpose[casualties]];
Wardakdates = Table[makedatelist[datestrings[[i]]],{i,1,Length[datestrings]}];

casualties = 
Import[
"/Users/dmeyer/Projects/ONR/AsymmetricExplosiveThreats/2009/papers/redqueen/Afghanistan/WesternAfghanistan.csv"
];
datestrings = First[Transpose[casualties]];
WesternAfghanistandates = Table[makedatelist[datestrings[[i]]],{i,1,Length[datestrings]}];

casualties = 
Import[
"/Users/dmeyer/Projects/ONR/AsymmetricExplosiveThreats/2009/papers/redqueen/Afghanistan/Zabul.csv"
];
datestrings = First[Transpose[casualties]];
Zabuldates = Table[makedatelist[datestrings[[i]]],{i,1,Length[datestrings]}];

AF plot

AFdates = 
Join[
Badghisdates,
Baghlandates,
Balkhdates,
Bamyandates,
EasternAfghanistandates,
Farahdates,
Faryabdates,
Ghaznidates,
Ghowrdates,
Helmanddates,
Heratdates,
Jowzjandates,
Kabuldates,
Kandahardates,
Kapisadates,
Khowstdates,
Kunardates,
Kunduzdates,
Laghmandates,
Logardates,
NAdates,
Nangarhardates,
Nimrozdates,
Nuristandates,
Oruzgandates,
Paktiadates,
Paktikadates,
Panjshirdates,
Parwandates,
Samangandates,
SouthernAfghanistandates,
Takhardates,
Unknowndates,
Wardakdates,
WesternAfghanistandates,
Zabuldates
];

all = Union[AFdates];
beg = {2001,10,1};
end = {2012,1,1};


c = Length[AFdates];
DateListPlot[
Tally[AFdates],
PlotLabel-> "Afghanistan" c,
BaseStyle-> {FontSize->18},
PlotRange->{{beg,end},{0,6.2}},
PlotStyle->Black,
Filling->Bottom,
FillingStyle->Directive[Thick,Red],
FrameTicksStyle->Directive[18],
AspectRatio->1/(3*GoldenRatio)
]

province plots

c = Length[Farahdates];
DateListPlot[
Tally[Farahdates],
PlotLabel-> "Farah" c,
BaseStyle-> {FontSize->18},
PlotRange->{{beg,end},{0,6.2}},
PlotStyle->Black,
Filling->Bottom,
FillingStyle->Directive[Thick,Red],
FrameTicksStyle->Directive[18],
AspectRatio->1/(3*GoldenRatio)
]

c = Length[Ghaznidates];
DateListPlot[
Tally[Ghaznidates],
PlotLabel-> "Ghazni" c,
BaseStyle-> {FontSize->18},
PlotRange->{{beg,end},{0,6.2}},
PlotStyle->Black,
Filling->Bottom,
FillingStyle->Directive[Thick,Red],
FrameTicksStyle->Directive[18],
AspectRatio->1/(3*GoldenRatio)
]

c = Length[Helmanddates];
DateListPlot[
Tally[Helmanddates],
PlotLabel-> "Helmand" c,
BaseStyle-> {FontSize->18},
PlotRange->{{beg,end},{0,6.2}},
PlotStyle->Black,
Filling->Bottom,
FillingStyle->Directive[Thick,Red],
FrameTicksStyle->Directive[18],
AspectRatio->1/(3*GoldenRatio)
]

c = Length[Kabuldates];
DateListPlot[
Tally[Kabuldates],
PlotLabel-> "Kabul" c,
BaseStyle-> {FontSize->18},
PlotRange->{{beg,end},{0,6.2}},
PlotStyle->Black,
Filling->Bottom,
FillingStyle->Directive[Thick,Red],
FrameTicksStyle->Directive[18],
AspectRatio->1/(3*GoldenRatio)
]

c = Length[Kandahardates];
DateListPlot[
Tally[Kandahardates],
PlotLabel-> "Kandahar" c,
BaseStyle-> {FontSize->18},
PlotRange->{{beg,end},{0,6.2}},
PlotStyle->Black,
Filling->Bottom,
FillingStyle->Directive[Thick,Red],
FrameTicksStyle->Directive[18],
AspectRatio->1/(3*GoldenRatio)
]

c = Length[Kapisadates];
DateListPlot[
Tally[Kapisadates],
PlotLabel-> "Kapisa" c,
BaseStyle-> {FontSize->18},
PlotRange->{{beg,end},{0,6.2}},
PlotStyle->Black,
Filling->Bottom,
FillingStyle->Directive[Thick,Red],
FrameTicksStyle->Directive[18],
AspectRatio->1/(3*GoldenRatio)
]

c = Length[Khowstdates];
DateListPlot[
Tally[Khowstdates],
PlotLabel-> "Khowst" c,
BaseStyle-> {FontSize->18},
PlotRange->{{beg,end},{0,6.2}},
PlotStyle->Black,
Filling->Bottom,
FillingStyle->Directive[Thick,Red],
FrameTicksStyle->Directive[18],
AspectRatio->1/(3*GoldenRatio)
]

c = Length[Kunardates];
DateListPlot[
Tally[Kunardates],
PlotLabel-> "Kunar" c,
BaseStyle-> {FontSize->18},
PlotRange->{{beg,end},{0,6.2}},
PlotStyle->Black,
Filling->Bottom,
FillingStyle->Directive[Thick,Red],
FrameTicksStyle->Directive[18],
AspectRatio->1/(3*GoldenRatio)
]

c = Length[Nuristandates];
DateListPlot[
Tally[Nuristandates],
PlotLabel-> "Nuristan" c,
BaseStyle-> {FontSize->18},
PlotRange->{{beg,end},{0,6.2}},
PlotStyle->Black,
Filling->Bottom,
FillingStyle->Directive[Thick,Red],
FrameTicksStyle->Directive[18],
AspectRatio->1/(3*GoldenRatio)
]

c = Length[Oruzgandates];
DateListPlot[
Tally[Oruzgandates],
PlotLabel-> "Oruzgan" c,
BaseStyle-> {FontSize->18},
PlotRange->{{beg,end},{0,6.2}},
PlotStyle->Black,
Filling->Bottom,
FillingStyle->Directive[Thick,Red],
FrameTicksStyle->Directive[18],
AspectRatio->1/(3*GoldenRatio)
]

c = Length[Paktikadates];
DateListPlot[
Tally[Paktikadates],
PlotLabel-> "Paktika" c,
BaseStyle-> {FontSize->18},
PlotRange->{{beg,end},{0,6.2}},
PlotStyle->Black,
Filling->Bottom,
FillingStyle->Directive[Thick,Red],
FrameTicksStyle->Directive[18],
AspectRatio->1/(3*GoldenRatio)
]

c = Length[Parwandates];
DateListPlot[
Tally[Parwandates],
PlotLabel-> "Parwan" c,
BaseStyle-> {FontSize->18},
PlotRange->{{beg,end},{0,6.2}},
PlotStyle->Black,
Filling->Bottom,
FillingStyle->Directive[Thick,Red],
FrameTicksStyle->Directive[18],
AspectRatio->1/(3*GoldenRatio)
]

c = Length[SouthernAfghanistandates];
DateListPlot[
Tally[SouthernAfghanistandates],
PlotLabel-> "Southern Afghanistan" c,
BaseStyle-> {FontSize->18},
PlotRange->{{beg,end},{0,6.2}},
PlotStyle->Black,
Filling->Bottom,
FillingStyle->Directive[Thick,Red],
FrameTicksStyle->Directive[18],
AspectRatio->1/(3*GoldenRatio)
]

c = Length[Wardakdates];
DateListPlot[
Tally[Wardakdates],
PlotLabel-> "Wardak" c,
BaseStyle-> {FontSize->18},
PlotRange->{{beg,end},{0,6.2}},
PlotStyle->Black,
Filling->Bottom,
FillingStyle->Directive[Thick,Red],
FrameTicksStyle->Directive[18],
AspectRatio->1/(3*GoldenRatio)
]

c = Length[Zabuldates];
DateListPlot[
Tally[Zabuldates],
PlotLabel-> "Zabul" c,
BaseStyle-> {FontSize->18},
PlotRange->{{beg,end},{0,6.2}},
PlotStyle->Black,
Filling->Bottom,
FillingStyle->Directive[Thick,Red],
FrameTicksStyle->Directive[18],
AspectRatio->1/(3*GoldenRatio)
]

gap sequence by province

days = Union[Farahdates];
days = Select[days,DateDifference[#,{2010,7,4}]>0 &];
gaps = Table[{i,DateDifference[days[[i]],days[[i+1]]]},{i,1,Length[days]-1}];
ListLogLogPlot[
gaps,
PlotLabel-> "Farah Δ(Subscript[t, n])",
BaseStyle-> {FontSize->18},
PlotStyle->{PointSize[Large],Red},
TicksStyle->Directive[18]
]

days = Union[Ghaznidates];
days = Select[days,DateDifference[#,{2010,7,4}]>0 &];
gaps = Table[{i,DateDifference[days[[i]],days[[i+1]]]},{i,1,Length[days]-1}];
ListLogLogPlot[
gaps,
PlotLabel-> "Ghazni Δ(Subscript[t, n])",
BaseStyle-> {FontSize->18},
PlotStyle->{PointSize[Large],Red},
TicksStyle->Directive[18]
]

days = Union[Helmanddates];
days = Select[days,DateDifference[#,{2010,7,4}]>0 &];
gaps = Table[{i,DateDifference[days[[i]],days[[i+1]]]},{i,1,Length[days]-1}];
ListLogLogPlot[
gaps,
PlotLabel-> "Helmand Δ(Subscript[t, n])",
BaseStyle-> {FontSize->18},
PlotStyle->{PointSize[Large],Red},
TicksStyle->Directive[18]
]

days = Union[Kabuldates];
days = Select[days,DateDifference[#,{2010,7,4}]>0 &];
gaps = Table[{i,DateDifference[days[[i]],days[[i+1]]]},{i,1,Length[days]-1}];
ListLogLogPlot[
gaps,
PlotLabel-> "Kabul Δ(Subscript[t, n])",
BaseStyle-> {FontSize->18},
PlotStyle->{PointSize[Large],Red},
TicksStyle->Directive[18]
]

days = Union[Kandahardates];
days = Select[days,DateDifference[#,{2010,7,4}]>0 &];
gaps = Table[{i,DateDifference[days[[i]],days[[i+1]]]},{i,1,Length[days]-1}];
ListLogLogPlot[
gaps,
PlotLabel-> "Kandahar Δ(Subscript[t, n])",
BaseStyle-> {FontSize->18},
PlotStyle->{PointSize[Large],Red},
TicksStyle->Directive[18]
]

days = Union[Kapisadates];
days = Select[days,DateDifference[#,{2010,7,4}]>0 &];
gaps = Table[{i,DateDifference[days[[i]],days[[i+1]]]},{i,1,Length[days]-1}];
ListLogLogPlot[
gaps,
PlotLabel-> "Kapisa Δ(Subscript[t, n])",
BaseStyle-> {FontSize->18},
PlotStyle->{PointSize[Large],Red},
TicksStyle->Directive[18]
]

days = Union[Khowstdates];
days = Select[days,DateDifference[#,{2010,7,4}]>0 &];
gaps = Table[{i,DateDifference[days[[i]],days[[i+1]]]},{i,1,Length[days]-1}];
ListLogLogPlot[
gaps,
PlotLabel-> "Khowst Δ(Subscript[t, n])",
BaseStyle-> {FontSize->18},
PlotStyle->{PointSize[Large],Red},
TicksStyle->Directive[18]
]

days = Union[Kunardates];
days = Select[days,DateDifference[#,{2010,7,4}]>0 &];
gaps = Table[{i,DateDifference[days[[i]],days[[i+1]]]},{i,1,Length[days]-1}];
ListLogLogPlot[
gaps,
PlotLabel-> "Kunar Δ(Subscript[t, n])",
BaseStyle-> {FontSize->18},
PlotStyle->{PointSize[Large],Red},
TicksStyle->Directive[18]
]

days = Union[Nuristandates];
days = Select[days,DateDifference[#,{2010,7,4}]>0 &];
gaps = Table[{i,DateDifference[days[[i]],days[[i+1]]]},{i,1,Length[days]-1}];
ListLogLogPlot[
gaps,
PlotLabel-> "Nuristan Δ(Subscript[t, n])",
BaseStyle-> {FontSize->18},
PlotStyle->{PointSize[Large],Red},
TicksStyle->Directive[18]
]

days = Union[Oruzgandates];
days = Select[days,DateDifference[#,{2010,7,4}]>0 &];
gaps = Table[{i,DateDifference[days[[i]],days[[i+1]]]},{i,1,Length[days]-1}];
ListLogLogPlot[
gaps,
PlotLabel-> "Oruzgan Δ(Subscript[t, n])",
BaseStyle-> {FontSize->18},
PlotStyle->{PointSize[Large],Red},
TicksStyle->Directive[18]
]

days = Union[Paktikadates];
days = Select[days,DateDifference[#,{2010,7,4}]>0 &];
gaps = Table[{i,DateDifference[days[[i]],days[[i+1]]]},{i,1,Length[days]-1}];
ListLogLogPlot[
gaps,
PlotLabel-> "Paktika Δ(Subscript[t, n])",
BaseStyle-> {FontSize->18},
PlotStyle->{PointSize[Large],Red},
TicksStyle->Directive[18]
]

days = Union[Parwandates];
days = Select[days,DateDifference[#,{2010,7,4}]>0 &];
gaps = Table[{i,DateDifference[days[[i]],days[[i+1]]]},{i,1,Length[days]-1}];
ListLogLogPlot[
gaps,
PlotLabel-> "Parwan Δ(Subscript[t, n])",
BaseStyle-> {FontSize->18},
PlotStyle->{PointSize[Large],Red},
TicksStyle->Directive[18]
]

days = Union[SouthernAfghanistandates];
days = Select[days,DateDifference[#,{2010,7,4}]>0 &];
gaps = Table[{i,DateDifference[days[[i]],days[[i+1]]]},{i,1,Length[days]-1}];
ListLogLogPlot[
gaps,
PlotLabel-> "Southern Afghanistan Δ(Subscript[t, n])",
BaseStyle-> {FontSize->18},
PlotStyle->{PointSize[Large],Red},
TicksStyle->Directive[18]
]

days = Union[Wardakdates];
days = Select[days,DateDifference[#,{2010,7,4}]>0 &];
gaps = Table[{i,DateDifference[days[[i]],days[[i+1]]]},{i,1,Length[days]-1}];
Print["Wardak:  ",Length[gaps]];
ListLogLogPlot[
gaps,
PlotLabel-> "Wardak Δ(Subscript[t, n])",
BaseStyle-> {FontSize->18},
PlotStyle->{PointSize[Large],Red},
TicksStyle->Directive[18]
]

days = Union[Zabuldates];
days = Select[days,DateDifference[#,{2010,7,4}]>0 &];
gaps = Table[{i,DateDifference[days[[i]],days[[i+1]]]},{i,1,Length[days]-1}];
ListLogLogPlot[
gaps,
PlotLabel-> "Zabul Δ(Subscript[t, n])",
BaseStyle-> {FontSize->18},
PlotStyle->{PointSize[Large],Red},
TicksStyle->Directive[18]
]

gap sequence by province

provinces = 
{"Farah",
"Ghazni",
"Helmand",
"Kabul",
"Kandahar",
"Kapisa",
"Khowst",
"Kunar",
"Nuristan",
"Oruzgan",
"Patika",
"Parwan",
"Southern Afghanistan",
"Wardak",
"Zabul"
};
params = {};

days = Union[Farahdates];
days = Select[days,DateDifference[#,{2010,7,4}]>0 &];
gaps = Table[{i,DateDifference[days[[i]],days[[i+1]]]},{i,1,Length[days]-1}];
dataplot = 
ListLogLogPlot[
gaps,
PlotLabel-> "Farah Δ(Subscript[t, n])",
BaseStyle-> {FontSize->18},
PlotStyle->{PointSize[Large],Red},
TicksStyle->Directive[18]
];
fit = Fit[Log[gaps],{1,x},x];
a = fit/.x->0;
b = (fit/.x->1)-a;
Print["Farah:  ",fit];
n = Length[gaps];
AppendTo[params,{a,-b}];
max = Log[n];
fitplot =
Plot[
fit,{x,0,max},
PlotStyle->{Thick,Blue},
PlotRange->All
];
Show[
dataplot,fitplot,
PlotRange->All
]

days = Union[Ghaznidates];
days = Select[days,DateDifference[#,{2010,7,4}]>0 &];
gaps = Table[{i,DateDifference[days[[i]],days[[i+1]]]},{i,1,Length[days]-1}];
dataplot =
ListLogLogPlot[
gaps,
PlotLabel-> "Ghazni Δ(Subscript[t, n])",
BaseStyle-> {FontSize->18},
PlotStyle->{PointSize[Large],Red},
TicksStyle->Directive[18]
];
fit = Fit[Log[gaps],{1,x},x];
a = fit/.x->0;
b = (fit/.x->1)-a;
Print["Ghazni:  ",fit];
n = Length[gaps];
AppendTo[params,{a,-b}];
max = Log[n];
fitplot =
Plot[
fit,{x,0,max},
PlotStyle->{Thick,Blue},
PlotRange->All
];
Show[
dataplot,fitplot,
PlotRange->All
]

days = Union[Helmanddates];
days = Select[days,DateDifference[#,{2010,7,4}]>0 &];
gaps = Table[{i,DateDifference[days[[i]],days[[i+1]]]},{i,1,Length[days]-1}];
dataplot = 
ListLogLogPlot[
gaps,
PlotLabel-> "Helmand Δ(Subscript[t, n])",
BaseStyle-> {FontSize->18},
PlotStyle->{PointSize[Large],Red},
TicksStyle->Directive[18]
];
fit = Fit[Log[gaps],{1,x},x];
a = fit/.x->0;
b = (fit/.x->1)-a;
Print["Helmand:  ",fit];
n = Length[gaps];
AppendTo[params,{a,-b}];
max = Log[n];
fitplot =
Plot[
fit,{x,0,max},
PlotStyle->{Thick,Blue},
PlotRange->All
];
Show[
dataplot,fitplot,
PlotRange->All,
AxesOrigin->{0,0}
]

days = Union[Kabuldates];
days = Select[days,DateDifference[#,{2010,7,4}]>0 &];
gaps = Table[{i,DateDifference[days[[i]],days[[i+1]]]},{i,1,Length[days]-1}];
dataplot = 
ListLogLogPlot[
gaps,
PlotLabel-> "Kabul Δ(Subscript[t, n])",
BaseStyle-> {FontSize->18},
PlotStyle->{PointSize[Large],Red},
TicksStyle->Directive[18]
];
fit = Fit[Log[gaps],{1,x},x];
a = fit/.x->0;
b = (fit/.x->1)-a;
Print["Kabul:  ",fit];
n = Length[gaps];
AppendTo[params,{a,-b}];
max = Log[n];
fitplot =
Plot[
fit,{x,0,max},
PlotStyle->{Thick,Blue},
PlotRange->All
];
Show[
dataplot,fitplot,
PlotRange->All
]

days = Union[Kandahardates];
days = Select[days,DateDifference[#,{2010,7,4}]>0 &];
gaps = Table[{i,DateDifference[days[[i]],days[[i+1]]]},{i,1,Length[days]-1}];
dataplot = 
ListLogLogPlot[
gaps,
PlotLabel-> "Kandahar Δ(Subscript[t, n])",
BaseStyle-> {FontSize->18},
PlotStyle->{PointSize[Large],Red},
TicksStyle->Directive[18]
];
fit = Fit[Log[gaps],{1,x},x];
a = fit/.x->0;
b = (fit/.x->1)-a;
Print["Kandahar:  ",fit];
n = Length[gaps];
AppendTo[params,{a,-b}];
max = Log[n];
fitplot =
Plot[
fit,{x,0,max},
PlotStyle->{Thick,Blue},
PlotRange->All
];
Show[
dataplot,fitplot,
PlotRange->All
]

days = Union[Kapisadates];
days = Select[days,DateDifference[#,{2010,7,4}]>0 &];
gaps = Table[{i,DateDifference[days[[i]],days[[i+1]]]},{i,1,Length[days]-1}];
dataplot = 
ListLogLogPlot[
gaps,
PlotLabel-> "Kapisa Δ(Subscript[t, n])",
BaseStyle-> {FontSize->18},
PlotStyle->{PointSize[Large],Red},
TicksStyle->Directive[18]
];
fit = Fit[Log[gaps],{1,x},x];
a = fit/.x->0;
b = (fit/.x->1)-a;
Print["Kapisa:  ",fit];
n = Length[gaps];
AppendTo[params,{a,-b}];
max = Log[n];
fitplot =
Plot[
fit,{x,0,max},
PlotStyle->{Thick,Blue},
PlotRange->All
];
Show[
dataplot,fitplot,
PlotRange->All
]

days = Union[Khowstdates];
days = Select[days,DateDifference[#,{2010,7,4}]>0 &];
gaps = Table[{i,DateDifference[days[[i]],days[[i+1]]]},{i,1,Length[days]-1}];
dataplot = 
ListLogLogPlot[
gaps,
PlotLabel-> "Khowst Δ(Subscript[t, n])",
BaseStyle-> {FontSize->18},
PlotStyle->{PointSize[Large],Red},
TicksStyle->Directive[18]
];
fit = Fit[Log[gaps],{1,x},x];
a = fit/.x->0;
b = (fit/.x->1)-a;
Print["Khowst:  ",fit];
n = Length[gaps];
AppendTo[params,{a,-b}];
max = Log[n];
fitplot =
Plot[
fit,{x,0,max},
PlotStyle->{Thick,Blue},
PlotRange->All
];
Show[
dataplot,fitplot,
PlotRange->All
]

days = Union[Kunardates];
days = Select[days,DateDifference[#,{2010,7,4}]>0 &];
gaps = Table[{i,DateDifference[days[[i]],days[[i+1]]]},{i,1,Length[days]-1}];
dataplot = 
ListLogLogPlot[
gaps,
PlotLabel-> "Kunar Δ(Subscript[t, n])",
BaseStyle-> {FontSize->18},
PlotStyle->{PointSize[Large],Red},
TicksStyle->Directive[18]
];
fit = Fit[Log[gaps],{1,x},x];
a = fit/.x->0;
b = (fit/.x->1)-a;
Print["Kunar:  ",fit];
n = Length[gaps];
AppendTo[params,{a,-b}];
max = Log[n];
fitplot =
Plot[
fit,{x,0,max},
PlotStyle->{Thick,Blue},
PlotRange->All
];
Show[
dataplot,fitplot,
PlotRange->All
]

days = Union[Nuristandates];
days = Select[days,DateDifference[#,{2010,7,4}]>0 &];
gaps = Table[{i,DateDifference[days[[i]],days[[i+1]]]},{i,1,Length[days]-1}];
dataplot = 
ListLogLogPlot[
gaps,
PlotLabel-> "Nuristan Δ(Subscript[t, n])",
BaseStyle-> {FontSize->18},
PlotStyle->{PointSize[Large],Red},
TicksStyle->Directive[18]
];
fit = Fit[Log[gaps],{1,x},x];
a = fit/.x->0;
b = (fit/.x->1)-a;
Print["Nuristan:  ",fit];
n = Length[gaps];
AppendTo[params,{a,-b}];
max = Log[n];
fitplot =
Plot[
fit,{x,0,max},
PlotStyle->{Thick,Blue},
PlotRange->All
];
Show[
dataplot,fitplot,
PlotRange->All
]

days = Union[Oruzgandates];
days = Select[days,DateDifference[#,{2010,7,4}]>0 &];
gaps = Table[{i,DateDifference[days[[i]],days[[i+1]]]},{i,1,Length[days]-1}];
dataplot = 
ListLogLogPlot[
gaps,
PlotLabel-> "Oruzgan Δ(Subscript[t, n])",
BaseStyle-> {FontSize->18},
PlotStyle->{PointSize[Large],Red},
TicksStyle->Directive[18]
];
fit = Fit[Log[gaps],{1,x},x];
a = fit/.x->0;
b = (fit/.x->1)-a;
Print["Oruzgan:  ",fit];
n = Length[gaps];
AppendTo[params,{a,-b}];
max = Log[n];
fitplot =
Plot[
fit,{x,0,max},
PlotStyle->{Thick,Blue},
PlotRange->All
];
Show[
dataplot,fitplot,
PlotRange->All
]

days = Union[Paktikadates];
days = Select[days,DateDifference[#,{2010,7,4}]>0 &];
gaps = Table[{i,DateDifference[days[[i]],days[[i+1]]]},{i,1,Length[days]-1}];
dataplot = 
ListLogLogPlot[
gaps,
PlotLabel-> "Paktika Δ(Subscript[t, n])",
BaseStyle-> {FontSize->18},
PlotStyle->{PointSize[Large],Red},
TicksStyle->Directive[18]
];
fit = Fit[Log[gaps],{1,x},x];
a = fit/.x->0;
b = (fit/.x->1)-a;
Print["Patika:  ",fit];
n = Length[gaps];
AppendTo[params,{a,-b}];
max = Log[n];
fitplot =
Plot[
fit,{x,0,max},
PlotStyle->{Thick,Blue},
PlotRange->All
];
Show[
dataplot,fitplot,
PlotRange->All
]

days = Union[Parwandates];
days = Select[days,DateDifference[#,{2010,7,4}]>0 &];
gaps = Table[{i,DateDifference[days[[i]],days[[i+1]]]},{i,1,Length[days]-1}];
dataplot = 
ListLogLogPlot[
gaps,
PlotLabel-> "Parwan Δ(Subscript[t, n])",
BaseStyle-> {FontSize->18},
PlotStyle->{PointSize[Large],Red},
TicksStyle->Directive[18]
];
fit = Fit[Log[gaps],{1,x},x];
a = fit/.x->0;
b = (fit/.x->1)-a;
Print["Parwan:  ",fit];
n = Length[gaps];
AppendTo[params,{a,-b}];
max = Log[n];
fitplot =
Plot[
fit,{x,0,max},
PlotStyle->{Thick,Blue},
PlotRange->All
];
Show[
dataplot,fitplot,
PlotRange->All
]

days = Union[SouthernAfghanistandates];
days = Select[days,DateDifference[#,{2010,7,4}]>0 &];
gaps = Table[{i,DateDifference[days[[i]],days[[i+1]]]},{i,1,Length[days]-1}];
dataplot = 
ListLogLogPlot[
gaps,
PlotLabel-> "Southern Afghanistan Δ(Subscript[t, n])",
BaseStyle-> {FontSize->18},
PlotStyle->{PointSize[Large],Red},
TicksStyle->Directive[18]
];
fit = Fit[Log[gaps],{1,x},x];
a = fit/.x->0;
b = (fit/.x->1)-a;
Print["Southern AF:  ",fit];
n = Length[gaps];
AppendTo[params,{a,-b}];
max = Log[n];
fitplot =
Plot[
fit,{x,0,max},
PlotStyle->{Thick,Blue},
PlotRange->All
];
Show[
dataplot,fitplot,
PlotRange->All
]

days = Union[Wardakdates];
days = Select[days,DateDifference[#,{2010,7,4}]>0 &];
gaps = Table[{i,DateDifference[days[[i]],days[[i+1]]]},{i,1,Length[days]-1}];
dataplot = 
ListLogLogPlot[
gaps,
PlotLabel-> "Wardak Δ(Subscript[t, n])",
BaseStyle-> {FontSize->18},
PlotStyle->{PointSize[Large],Red},
TicksStyle->Directive[18]
];
fit = Fit[Log[gaps],{1,x},x];
a = fit/.x->0;
b = (fit/.x->1)-a;
Print["Wardak:  ",fit];
n = Length[gaps];
AppendTo[params,{a,-b}];
max = Log[n];
fitplot =
Plot[
fit,{x,0,max},
PlotStyle->{Thick,Blue},
PlotRange->All
];
Show[
dataplot,fitplot,
PlotRange->All
]

days = Union[Zabuldates];
days = Select[days,DateDifference[#,{2010,7,4}]>0 &];
gaps = Table[{i,DateDifference[days[[i]],days[[i+1]]]},{i,1,Length[days]-1}];
dataplot = 
ListLogLogPlot[
gaps,
PlotLabel-> "Zabul Δ(Subscript[t, n])",
BaseStyle-> {FontSize->18},
PlotStyle->{PointSize[Large],Red},
TicksStyle->Directive[18]
];
fit = Fit[Log[gaps],{1,x},x];
a = fit/.x->0;
b = (fit/.x->1)-a;
Print["Zabul:  ",fit];
n = Length[gaps];
AppendTo[params,{a,-b}];
max = Log[n];
fitplot =
Plot[
fit,{x,0,max},
PlotStyle->{Thick,Blue},
PlotRange->All
];
Show[
dataplot,fitplot,
PlotRange->All
]

plotting the escalation parameters

dataplot = 
ListPlot[
params,
BaseStyle-> {FontSize->18},
PlotStyle->{PointSize[Large],Blue},
TicksStyle->Directive[18]
];
params[[1]]
fit = Fit[params,{1,x},x];
min = Min[First[Transpose[params]]];
max = Max[First[Transpose[params]]];
fitplot =
Plot[
fit,{x,0.8min,max+0.2min},
PlotStyle->{Thick,Green},
PlotRange->All
];
Show[
dataplot,fitplot,
BaseStyle-> {FontSize->18},
AxesLabel->{"log(Δ(Subscript[t, 1]))","β"}
]