lunes, 8 de agosto de 2016

R/simecol Simulation Model for the Battle of Iwo Jima

It was about 71 years ago today that the Second World War on the Asian front ended. After the tragic Little Boy and Fat Man detonations over Hiroshima and Nagasaki on the 6th and 9th of August 1945, respectively, the Japanese surrendered in August 14th.

When I taught the Simulation and Modeling course for the Systems Engineering department at the UNEFA, we used to do an exercise in class on simulating the battle of Iwo Jima, one of the most decisive and sanguinary battles in the Pacific. This simulation was based on a System Dynamics model derived from the Lanchester Laws of combat and was implemented in R using the simecol/deSolve/FME packages. Prior to the class, we had covered the topic of Forrester diagrams and System Dynamic models in general1, the Lanchester Laws of combat and of course a bit of background on the use of the simecol and related packages for dynamic model fitting and simulation.

In this post, I will present a brief summary on the Lanchester Laws of Combat, some historical background on the battle of Iwo Jima and then go into the simulation model itself, detailing its implementation and data fitting in R through the said packages. Subsequently, I will contrast the model's output with the real historical data and derive some interpretations. To conclude the post, I will pose some "what if ..." questions on alternative hypothetical scenarios and offer some thoughts about possible applications of simulation models like this one for teaching history in classrooms.

The Lanchester Models of Combat


Frederick Lanchester was a British engineer well-known for his inventions and contributions to the budding automotive industry at the end of the nineteenth century (he's the guy that invented the accelerator pedal, for example). Lanchester also made some contributions to the theory of aerodynamics and being concerned over the ways in which the aeronautical industry could change warfare (he was more of a pacifist, really), he set out to study the dynamics of warfare and develop mathematical models of battle through systems of differential equations, now known as the Lanchester Laws of Combat. These differential equation models are fairly abstract - they leave out many details that we commonly associate with battles and focus on the way in which number of combat units of two armies decrease over time.

Without loss of generality, we will represent in each time instant \(t\) the number of troops or combat units of the red army as \(R(t)\) or \(R\) and of the green army as \(G(t)\) or simply \(G\). At the start of the battle, at \(t=0\), \(R(0)\) and \(G(0)\) represent the number of combat units of each army. When \(R(t)\) or \(G(t)\) reach 0 at any given time, the corresponding army is left without troops and so the battle ends with the opposing army as victorious. Lanchester proposed two different scenarios for battle, according to the warfare technology used:

 

 First Lanchester Law


In the first Lanchester Law, two armies confront each other in hand-to-hand combat. At each time instant, the number of casualties of each army is proportional to the number of confrontations between the combatant units and the effectiveness or lethality coefficient of the enemy army. This is represented mathematically by the following differential equations:

\[\begin{align*}\dfrac{dR}{dt} &= -g \cdot R \cdot G \\ \dfrac{dG}{dt} &= -r \cdot R \cdot G\end{align*} \]

Derivatives \(\tfrac{dR}{dt}\) and \(\tfrac{dG}{dt}\) indicate the way in which the battle unfolds and represent the rate of attrition of the red and green armies, respectively. The \(r\) y \(g\) parameters are the effectiveness coefficients of each army and represent the number of casualties on the enemy side inflicted during one time instant at each confrontation (represented by \(R \cdot G\)). This model of combat is also referred to as the the model of "unaimed fire", the word "fire" in this case not necessarily referring to artillery fire but rather to the directionality of discharge of the lethal armament used in combat. In fact, this model, being applied mainly to battle scenarios with no artillery can also be used for battles with low-precision artillery.

If we divide one equation by the other and isolate the red and green terms on each side, we obtain \(r \cdot dR = g \cdot dG\). In turn, if we integrate (with respect to \(t\)) this last equation we can see that at each time instant, the expression \(r\cdot R(t) - g \cdot G(t)\) remains constant. The terms \(r\cdot R\) and \(g \cdot G\) are called the fighting strengths of the reds and greens, respectively. The fighting strengths, which could also be considered as the number of troops eliminated the the red and green armies, determine result of the battle. Since \(r\cdot R(t) - g \cdot G(t)\) is constant throughout the whole time, the reds will win if \(r\cdot R(t) - g \cdot G(t) > 0\), the greens win if \(r\cdot R(t) - g \cdot G(t) < 0\) and if \(r\cdot R(t) - v \cdot G(t) = 0\), then both sides will be wiped out simultaneously. Since the fighting strengths are linear in \(R\) and \(G\), the first Lanchester Law is also known as the linear law of combat.


We can infer some characteristics of combat scenarios based on this linear law of combat:
  1. An army's efficiency parameter and its number of troops are equally important factors to its fighting strength (ie. if you double the number of troops but decrease the efficiency to one half, the fighting strength will be the same).
  2. If you manage to divide the enemy in two contingents and confront each contingent successively, this will not alter the result of the battle.

 

Second Lanchester Law


This law supposes a scenario where both sides use aimed artillery fire, hence the casualty infliction mechanism no longer depends on the number of hand-to-hand combat confrontations being produced, but rather on the number of troops firing upon the enemy:

\[\begin{align*} \dfrac{dR}{dt} &= -g \cdot G \\ \dfrac{dG}{dt} &= -r \cdot R\end{align*} \]


Again, dividing one equation by the other, isolating the terms corresponding to each army and integrating, we obtain the following constant expression: \(r\cdot R^2 -g \cdot G^2=0\). This time, the fighting strengths \(r\cdot R^2\) and \(g \cdot G^2\) are quadratic on \(R\) and \(G\), hence the alternative name of "square law of combat" being applied to Lanchester's Second Law. In two armies with equal number of troops, the more efficient one will prevail. If however, one army manages to divide the enemy in two or more contingents and confront each contingent successively, then it will certainly win over the other. This is what Von Clausewitz and Sun Tzu meant by advising generals not to divide their troops because each division would significantly reduce an army's fighting strength. In other words, if an army is numerically superior, then it must combat undivided against a more efficient enemy. As an example of this principle, Hannibal confronted a qualitatively superior enemy at Cannas by dividing him and prevailed. Conversely, the American strategy of flooding the island of troops at Iwo Jima proved effective in managing to establish a beach head.

 

Applications of the Lanchester combat models and further elaborations


Lanchester originally applied his model to the study of Nelson's naval tactics in the Battle of Traffalgar, that famous naval battle of the Napoleonic Wars. In more recent literature, Lanchester models were applied to the Kursk battle in 1943 involving panzers in the German and Soviet sides, the battle of Ardennes (again in World War II) and the naval conflict in the Atlantic in which the German U-Boats inflicted damage on the Allied convoys. In the Engel 1954 paper we find an application to the Battle of Iwo Jima, based on the data compiled by Cliiford and Moorehouse. On this last point, I must remark that the model fits to these battles has been partially successful due to the fact that under normal battle conditions, it is quite difficult to accurately compile day-to-day data of casualties on both sides.

The Lanchester models themselves can be further generalized to include reinforcement like so:

\[\begin{align*}\dfrac{dR}{dt} &= f_r(t) - g \cdot G \\ \dfrac{dG}{dt} &= f_g(t) -r \cdot R \end{align*} \]


Here, \(f_r(t)\) and \(f_g(t)\) represent the reinforcement rates of the red and green armies respectively. This is the model we will use for our Battle of Iwo Jima simulation, as the American side brought in reinforcements on several occasions, while, as we shall see, the Japanese had none.

If we are willing to relax our assumptions that the battle is based wholly on either an aimed or an unaimed fire combat model, then we get Bracken's generalized Lanchester Model:

\[\begin{align*} \dfrac{dR}{dt} &= -g \cdot R^q \cdot G^p \\ \dfrac{dG}{dt} &= -r \cdot R^p \cdot G^q\end{align*} \]


If we define \(\alpha=1+p-q\), we get \(gG^\alpha-rR^\alpha\) as the constant quantity and we can easily see how the first and second Lanchester models are particular cases of this model. However (see MacKay, 2005), when fitting this model to any particular battle there is an ambiguity in the estimates for \(p\) and \(q\), as several best fitting estimates could be obtained.

 

Some historical background on the Battle of Iwo Jima2


The island of Iwo Jima3 is a tiny island of some 8 square miles situated about 750 miles south from Tokyo in the Japanese mainland and halfway between Saipan and Tokyo. Were it not for this last fact, the place would not have been the stage of a major battle in the Second World War and would probably remain largely unknown today. By the summer of 1944, the Americans had gained control of Saipan and the Mariana islands, from where they staged bombing raids to mainland Japan with long range B-29 Superfortress bombers. However, the losses inflicted upon these bomber planes by Japanese fighter planes deploying from the two airfields in Iwo Jima were unsustainable to the Americans and furthermore, the island's radio station relayed early warning reports to the mainland to ready themselves for the bombing raids. For these reasons, it was of strategic importance to the Americans on their northward multi-pronged move towards Japan to seize control of Iwo Jima. And, naturally, the Japanese knew this.

For the Japanese, Iwo Jima was more than just strategically significant. Iwo Jima was sacred Japanese soil. On account of this, an eventual American invasion of Iwo Jima would be a heavy blow to the Japanese morale as for more than four thousand years, no foreign country had invaded Japan. Therefore, the Japanese were not ready to surrender the island without first inflicting heavy losses upon the American forces. Emperor Hirohito intrusted Lietenant General Tadamichi Kuribayashi4 with this mission.
Kuribayashi drew up his plan for the defense of the island upon the following premises:
  • The Japanese would engage in combat from underground, not on the surface of the island.
  • The battle would be defensive, the idea being to seriously erode the American forces.
  • No Japanese soldier would survive.
  • Every Japanese was to kill 10 Americans before being killed.
Kuribayashi's strategy stood apart from the usual Japanese tactics to which the Americans had become accustomed. He specifically forbade the famous "Banzai" suicide attacks to repel the American disembarkation on the island, which besides, were completely futile to prevent it, since the Japanese would not be receiving air or naval support, and hence no reinforcements. Instead, he began construction of a gallery of underground tunnels connecting a network of bunkers and pillboxes. By the time the Americans arrived, the Japanese had completed over 11 miles of tunnels and placed large artillery pieces protected by thick steel walls from within Mount Suribachi.

For their part, Americans were also preparing for what they designated as Operation Detachment (the invasion of Iwo Jima). According to their intelligence reports, there were some 14,000 Japanese troops on the island (there were really over 21,000). Before D-Day, and based on their experience at Saipan, Tarawa and Peleliu, the Marines requested for 10 days of previous bombings. The Navy finally acquiesced and on the 16th of February, 1945 began a 3-day bombing. Previously, though, B-29s had completed a 72 day bombing campaign.
The bombing campaign on Iwo Jima had been devastating ... but only on the surface. Inexplicably, not only had the Japanese defensive fortifications not diminished, according to an American intelligence report, but they had grown in number from 450 to 750 3 months after the bombings began. For the unsuspecting American forces, the real surprise lay waiting for them underground...

On D-day (February 19th), the Americans disembarked 54,000 troops. During the first moments, many thought that no Japanese had survived the bombings and that the estimates on the number of Japanese troops were exaggerated. Then, as the troops made their way 300 yards into the beach and the spot became congested with troops and equipment (what Kuribayashi was waiting for), all hell broke loose. There was crossfire from Mount Suribachi and some hills to the north of the island. The beach offered no protection, as the fine and ashy volcanic sands made it impossible to dig trenches. As Japanese fire impacted upon the disembarkation boats, the amphibious vehicles got stuck in the fine sands. The beaches of Iwo Jima became an infernal chaos in the carnage that ensued.

During the first days of battle, it seemed like the Americans had made no progress at all. They were fighting an enemy they couldn't see - an enemy who fought from under the ground and usually at night. Upon burning underground burrows where Japanese were thought to be with flamethrowers, Americans were surprised to see Japanese troops re-emerge from burrows that were thought to be "cleansed" days ago. What the unsuspecting Americans didn't know is that these holes and burrows were part of a vast network of underground tunnels. In the meantime, from the 20th to the 23rd day of February, the Marines attempted to take Suribachi. A small group of Marines eventually managed to raise the American flag on the top of Mount Suribachi, a moment immortalized for posterity in the famous historical photograph by Joe Rosenthal5.

Fighting continued for 36 days after the start of the battle. Once Suribachi was taken, the Americans continued to slowly and painfully advance to the north of the island, encountering fierce pockets of Japanese resistance along the way. One can only surmise about the fierceness of the combat that took place on Iwo Jima by reading the names of certain places on a map of the island, such as "the meat grinder". During the whole of Operation Detachment, the Americans made two more disembarkation of troops: one of 6,000 men and another of 13,000 men on the third and sixth day of the battle, respectively. In total, the Americans sustained 28,000 casualties including about 8,000 dead. The cost of taking this small island was much more than they expected. As for the Japanese, over 20,000 died and about 1000 were taken prisoners. The last two holdouts6 did not surrender until 1951. It is said that Kuribayashi himself died in a suicide raid on the southern part of the island disguised as a common soldier without his rank of General insignia.

Data for the simulation study


The data for this simulation study is based on a report titled "The Iwo Jima Operation" written by Captain Clifford Moorehouse, an American officer. This report contains day-to-day records on the number of American casualties. Together with the data on the number of American troops put ashore on the three disembarkations, this data serves to reconstruct the number of active American troops on the given days of the 36-day battle. Of course, we must assume an estimate number of 21,500 Japanese troops at the start of the battle and 0 active Japanese troops at the end, in between which no estimates exist. The data for the number of active troops on each side is summarized in the following table, in which the "time" column indicates the day of the battle and the "ame" and "jap" columns indicate the active troops for the Americans and the Japanese, respectively:

time ame jap time ame jap time ame jap
0 0 21500 13 59549 NA 25 53347 NA
1 52839 NA 14 59345 NA 26 53072 NA
2 50945 NA 15 59081 NA 27 52804 NA
4 56031 NA 16 58779 NA 28 52735 NA
5 53749 NA 17 58196 NA 29 52608 NA
6 66155 NA 18 57259 NA 30 52507 NA
7 65250 NA 19 56641 NA 31 52462 NA
8 64378 NA 20 54792 NA 32 52304 NA
9 62874 NA 21 55308 NA 33 52155 NA
10 62339 NA 22 54796 NA 34 52155 NA
11 61405 NA 23 54038 NA 35 52155 NA
12 60667 NA 24 53938 NA 36 52140 0

The data on the three American disembarkations can be summarized by the following stepwise function definition:

\[f(t) = \left\{ \begin{array}{cl} 54000 & 0 \leq t \lt 1 \\ 0 & 1 \leq t \lt 2 \\ 6000 & 2 \leq t \lt 3 \\ 0 & 3 \leq t \lt 5 \\ 13000 & 5 \leq t \lt 6 \\ 0 & 6 \leq t \leq 36 \end{array} \right.\]

Engel (1954) estimated the effectiveness coefficients for the Americans and the Japanese to be 0.0106 and 0.0577 respectively. We can take these values to simulate the model and compare its fit to the actual observed number of active troops according to the Moorehouse data. Then we will fit these parameters using simecol's fitOdeModel function and see if we obtain an even better fit. I must remark that when using simecol, it is not necessary to know in advance the values of your model's parameters, as the fitOdeModel takes care of this problem for you. After all, estimating a model's parameters is one of the main reasons why we build simulation models in the first place.

 

R/simecol implementation for the simulation model of the Battle of Iwo Jima


We have come to the core of this blog entry: the implementation of the simulation model for the Battle of Iwo Jima using R and simecol. First off, let me briefly explain what simecol is. It is an R package for the simulation of ecological models through R's S4 object class system using a state-space representation. What this means (the S4 object class part) is that you can work with several model objects in memory having different parameter values, etc. and simulate them, fit their parameters separately and so on, using an object-oriented methodology that makes it easy for researchers without extensive knowledge of R programming to get their simulation models up and running quickly using a general purpose programming language like R, which provides them with flexibility in modeling while at the same time access to all the powerful statistical/analytical tools available through the base R and extensive package system.

The state-space representation part mentioned in the last paragraph means that the various types of models one can implement in simecol- 1) dynamic system models using differential equations (or simecol odeModel class objects. This is the type we will deal with here), 2) cellular automata models and 3) individual agent based models - are viewed as subtypes of a more general family of models in which you have: 1) a set of variables describing the state of the model at a given time, 2) rules governing the way these state variables change over time, 3) a set of model parameters 4) a specification for the time instants at which you wish to observe the state variables, 5) externalities (called inputs), which are not part of the state variables of the system interrelated amongst each other but which affect them and 6) a specification for a solver function, which updates the state variables based on the rules that describe their change over time.

Schematic diagram of simecol odeModel objects external inputs differential equations parameters state variables output (state variables) initial state (state variables) solver (rk4, lsoda, etc.) t ⇦ t + Δt

In the case of dynamic system models with differential equations, the rules describing the way the system changes over time are obviously characterized by a system of differential equations. These differential equations usually have parameters that further characterize the dynamic behavior of the system and which the researcher is usually interested in fitting from observed data. In this battle of Iwo Jima example, the parameters would be the effectiveness coefficients of the Americans and the Japanese. In our Iwo Jima model we also have the American reinforcements- those would be the inputs (or externalities) which are included in the differential equation describing how the number of American troops changes over time. Finally, the solver function is a specification of a particular numerical integrator that solves for the state variables using the differential equations, for example, 4th-order Runge-Kutta, Euler, LSODA, etc. In this sense, simecol serves as a wrapper for another package called deSolve, which includes the compiled FORTRAN numerical integration routines for fast execution in R.

Without further ado, here's the R script for the simulation of the Battle of Iwo Jima using the simecol library:


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
library(simecol)
iwojima_engel <- new("odeModel",
    main = function (time, init, parms, ...) {
        x <- init
        p <- parms
        f <- approxTime1(inputs, time, rule = 2)["reinforcements"]
        dame <- f - p["j"] * x["jap"]
        djap <- - p["a"] * x["ame"]
        list(c(dame, djap))
    },
    parms = c(j=0.0577, a=0.0106),
    times = c(from=0, to=36, by=0.01),
    init = c(ame=0, jap=21500),
    inputs = as.matrix(data.frame(
                day = c(0, 0.999, 1, 1.999, 2, 2.999, 3, 4.999, 
                        5, 5.999, 6, 36),
                reinforcements = c(54000, 54000, 0, 0, 6000, 6000, 0, 0, 
                            13000, 13000, 0, 0))),
    solver = "lsoda"
) 
#copy the iwojima Engel model onto another for fitting later
iwojima_fitode <- iwojima_engel
#now read the actual data...
obs <- read.csv2("iwo_jima.csv")
#the weightdf dataframe assigns equal weight to all observations,
#except for the NA values in the japanese column (those get 0 weight)
weightdf <- data.frame(ame=rep(1, nrow(obs)), jap = rep(0, nrow=(obs)))
weightdf[1,"jap"] <- 1
weightdf[nrow(obs),"jap"] <- 1
#return the ssq of the Engel model (a measure of goodness of fit)
ssqOdeModel(parms(iwojima_engel),
  iwojima_engel,
  obstime = obs$time,
  yobs=obs[2:3],
  weights=weightdf)
#and now we fit the model parameters with simecol's fitOdeModel
#including our weightdf as weights makes the PORT routine faster
result_fit <- fitOdeModel(iwojima_engel,
  obstime=obs$time,
  yobs=obs[2:3],
  fn=ssqOdeModel,
  weights=weightdf,
  method="PORT",
  scale=c(1/0.1, 1/0.01),
  lower=c(j=0,a=0))
result_fit
#we update the new model parameters
parms(iwojima_fitode) <- result_fit$par
ssqOdeModel(parms(iwojima_fitode),
  iwojima_fitode,
  obstime = obs$time,
  yobs=obs[2:3],
  weights=weightdf)
#finally we simulate and plot the graphs
iwojima_engel <- sim(iwojima_engel)
iwojima_fitode <- sim(iwojima_fitode)
svg("iwojima_engel.svg")
matplot(x=iwojima_engel@out,
  main = "Model1 : Engel(1954)",
  xlab = "Day",
  ylab = "Number of active troops",
  type = "l", lty = c("solid", "solid"), 
  col = c("blue","red"))
points(obs$time,obs$ame,col="blue",pch=19)
points(obs$time[c(1,36)],obs$jap[c(1,36)],col="red",pch=19)
graphics.off()
svg("iwojima_fitode.svg")
matplot(x=iwojima_fitode@out, 
  main = "Model2 : fitOdeModel",
  xlab = "Day",
  ylab = "Number of active troops",
  type = "l", lty = c("solid", "solid"), 
  col = c("blue","red"))
points(obs$time,obs$ame,col="blue",pch=19)
points(obs$time[c(1,36)],obs$jap[c(1,36)],col="red",pch=19)
graphics.off()

Let's go over the code above. First, in line 1 we load the simecol library. In lines 2-20, we define an odeModel class object called "iwojima_engel". Notice how the "main" slot serves to specify the system of differential equations as a function returning the differentials on each state variable as a list. The other simecol methods will "know" that these differentials will correspond to the "ame" and "jap" variables because they are given as a list in the same order as we specify them in the "init" slot on line 13. Notice that the f function used to represent the American reinforcements is given as a function of the "inputs" slot defined in lines 14-18 (we will later explain what that approxTime1 function does). The "times" slot in line 12 is given in very small increments of 0.01 days so that the solver function (specified as "lsoda" in line 19) can do the numerical integration in small steps.

In line 24 we read in the Moorehouse data stored in a csv file (if you want to do this simulation exercise yourself, just take the Moorehouse data from the table above and put it in a csv file in the same directory as the R script (the separation character is a semicolon). Lines 27 to 29 simply create a data frame of the same dimensions as the "obs" data frame with 1 for valid values and 0 for NA values on that data frame. This simply serves to assign equal weights to each observed non-NA value so as to make the parameter fitting faster later on.

Lines 31-35 simply invoke the ssqOdeModel function on the iwojima_engel object to compute a measure of goodness of fit (consult the help page for ssqOdeModel to see how it is calculated). Lines 38-46 do the actual fitting of the iwojima_engel model object, producing a better-fitting set of parameters (remember, the American and Japanese effectiveness parameters). To do this, the fitOdeModel invokes a non-linear optimization routine using the PORT algorithm to obtain the set of parameter values that minimize the ssqOdeModel measure. In fact, this produces a better fit of the model (indicated by a lower ssqOdeModel value).

In line 48 we simply feed the new parameters into the iwojima_fitode, which was simply a copy of the iwojima_engel object and finally, in lines 55-76 we plot both model objects. Notice how the svg graphics device is used instead of pdf or png graphics. The svg graphics device produce better looking, non pixelating graphics that look great no matter how much you zoom in the page on your browser.

Model with parameters estimated by Engel (1954)
Model with parameters fitted by fitOdeModel
Finally, for comparison, we include a little table with the main results used to compare the different parameter values (Engel's estimations and the simecol estimations):

Engel (1954)fitOdeModel
Japanese Effectiveness0.05770000.05540003
American Effectiveness0.01060000.01080927
ssqOdeModel0.31676290.05121009

Interpretation of the simulation results and some what-if questions


Before I go on with the most fun part of modeling (playing with your models and interpreting them), I must clarify that simecol is a package originally intended for ecological modeling. It has also been used for engineering and economics modeling. However, because it is so versatile, I have used it for a military-related application such as simulating a battle using a Lanchester model, which is not an application for the package that its creators originally intended nor support. I do not mean by this that my view on this matter is different from the authors of simecol. In fact, I can see their wisdom in not supporting applications of simecol that they're afraid of.

What motivated me to present this model of the Battle of Iwo Jima are mainly educational reasons. First of all, the topic of historic and real battles is usually interesting for the young audiences to whom I've given classes on modeling and simulation. For me as a teacher, this serves as a sugar-coating to make the mathematical modeling and computational implementation topic-pills go down easier. Another important reason for me as a teacher is that these type of models lend themselves to interesting interpretations and discussions in class about politics and history. It gives us, as we shall see, a scientific framework for discussing about history and other social topics. To quote one of the authors on the bibliography I consulted:

Lanchester models provide an excellent example of the strengths (and weaknesses) of simple mathematical modeling. Further, as we have seen, the basic model leads to many other ‘What if...?’ questions which can be easily investigated. Many more such questions can be asked, and of course once one begins numerical simulations the possibilities are endless. To model warfare can seem more politically challenging (not to say incorrect) than to use ecology or epidemiology, but a little understanding of how military planners arrive at their tactical conclusions can also strip away mystique and (for this author, at least) expose some of the subject’s limitations! (MacKay, 2005, p. 7)

Some possible 'what-if' questions or questions for interesting discussion:
  • Given the same effectiveness of the American and Japanese troops as those found in your model, with how many troops would the Japanese have won the Battle of Iwo Jima if the Americans had disembarked the same amount of troops on the island? Would it have been possible for the Japanese to amass this number of troops given the space and logistic limitations of Iwo Jima?
  • If the Japanese soldiers were 5 times more effective or lethal than the Americans, why did more Japanese die in Iwo Jima?
  • How many soldiers would the Japanese have needed to make the battle linger for, say, one year? How many American casualties would this have brought about? Would this have changed the outcome of the war?
  • Lanchester models are based on conventional warfare. Nowadays, this conventional warfare scenario is not as generalized as before. For example, it is said that in Venezuela there is a non-conventional war being waged, although there are no battles in the classical sense involving regular military forces. There are civilian casualties, such as those caused by one of the highest crime rates in the world. And now, there is an added element of extreme scarcity of foods and medical supplies which cause civilian casualties as well. How would you as a modern-day Lanchester propose a differential equation model for this war scenario? What state variables and parameters would you define?
As you can see, the subject lends itself to some very interesting discussions in class. I might add that mathematical modeling of this sort gives us a fresh new perspective on social issues and gives us the foundations for discussing about these issues in a more scientific and less dogmatic way. I think having this sort of discussion integrated into our educational system is much needed today, particularly in my country.

As a closing remark for the readers of this blog, let me say that I will post more about simecol and other related packages, such as FME (with more added functionalities for parameter fitting). And no, the other posts won't be about military/warfare models! Stay tuned...

Acknowledgements

I wish to thank, first and foremost, you, dear reader, for putting up with such a long post. My thanks go out to the creators of the simecol package. Dr. Thomas Petzoldt's kind help on the R-sig-dyn-mod mailing list has been invaluable in helping me come to grips with this powerful R modeling tool. I would also like to thank James Cagney for his historyanimated media on the Battle of Iwo Jima. It helped me to understand the military and historical background of the battle. Make sure to check out his historyanimated site! Finally, I would like to thank Professor Christine Lind for providing me with the Moorehouse data without which this post would not have been possible.

Notes

  1. There are some excellent and thought provoking articles on the educational application of System Dynamics to school children without any Calculus background by the System Dynamics in Education Project, led by Jay Forrester himself. In a 1992 article, Forrester criticizes pre-college education as "poorly serving the needs of society", because it does not take into account the complex interactions between people and phenomena. The system dynamics view, Forrester argued, would empower schoolchildren to deal with complexity. Implementation of these ideas in the classroom entails the use of software like STELLA II or Vensim (both commercial packages with GUI's available both for Macintosh and Windows). It would be awesome if there was a such an application for R using the simecol and FME packages as backends for the actual simulation and fitting of SD models, but including a GUI with which schoolchildren could construct such models from Forrester diagrams... Oh! I'm daydreaming again.
  2. There is an excellent series of animated presentations available at the Historyanimated site (see Cagney, 2008). I contacted the author himself, James Cagney, in 2011 for permission to use his material in class and for some class notes I was preparing and thinking about publishing on the web. He told me to add the following interesting note: "The animation for The Battle of Gettysburg (civilwaranimated) is used to train smoke jumpers in the western US (men who parachute from airplanes to fight forest fires) - they tell me that fighting a fire is just like fighting a battle.". So there it is, James!
  3. Iwo Jima, or Iō-tō ("sulphur island" in japanese) was first visited by a Westerner in 1543, a Spaniard by the name of Bernardo de la Torre, who called the island "Isla de Sufre" or Sulphur Island (Sufre was the archaic Spanish spelling for azufre or sulphur). It is an appropriate name, as the southernmost tip of the island hosts a volcanic vent (hence the sulphur) that produces the island's most prominent geographic feature: Mount Suribachi. The fine volcanic ash sands of its beaches would prove a major nuisance for the americans as they tried to disembark amphibious vehicles during their invasion of the island. On account of this sulphur, no other scenario of any World War II battle could better resemble hell and in fact, ancient Japanese legend has it that the island was inhabited by demons.
  4. A man descended from 5 generations of samurai, Koribayashi was also a veteran of the Manchurian and Chinese campaigns. He had previously served as military attaché in Washington during the 1920's, where he acquired extensive knowledge of Americans. About the latter, he wrote: "The U.S.A. is the last country in the world against whom the Japanese should wage war" (Anonymous, 2006).
  5. At this point I would digress in class and talk to my students about how this Pulitzer-winning photograph was an artistic marvel. I would also mention to them that in Venezuela, we also have our own "Joe Rosenthal". His name was Héctor Rondon and his famous picture of a chaplain helping a wounded Venezuelan soldier in a street corner, amidst friendly and unfriendly crossfire, also won the Pulitzer Prize in 1963 and was featured in LIFE Magazine.

    The events surrounding this "Pietá"-like picture were those of the Porteñazo, a military coup led by communist rebels backed by Cuba against the democratically elected president Romulo Betancourt in 1962. It is ironic that while today, the Chavista propaganda talks about US imperialism and intervention in our country before the so-called Socialist Revolution, the Cuban regime had tried on several ocassions to export their revolution to Venezuela (El Porteñazo was one such incident in which over 100 Venezuelan soldiers died). That was until Hugo Chavez came along and peacefully handed control of this country to the Cuban Castro regime without a single shot being fired. At any rate I leave you a small print of the photograph for your viewing.

    rondon.png
  6. On the subject of Japanese holdouts, there is the noteworthy case of Hiroo Onoda, who did not surrender in 1945 and spent 30 years in the jungles of the Philipines (if you didn't know about Onoda, look him up. It's one hell of a story). An english progressive rock band called Camel made a concept album called Nude inspired upon the true story of Hiroo Onoda (the name Nude derives from his family name Onoda).

Bibliographical References

  • ANONYMOUS. (2006). "Iwo Jima el Test Supremo". Post in online forum. Retrieved March 2011, from http://www.forosegundaguerra.com/viewtopic.php?p=18492
  • Battle of Iwo Jima. (2016, August 2). In Wikipedia, The Free Encyclopedia. Retrieved August 5, 2016, from https://en.wikipedia.org/wiki/Battle_of_Iwo_Jima
  • CAGNEY , J. (2008). PacificWarAnimated.com - Historical Animation of the Battle of Iwo Jima. Nonprofit History Animated Foundation. Oregon, US. Retrieved March 2011 from http://pacificwaranimated.com/Iwo.html
  • ENGEL, J. H. (1954). "A Verification of Lanchester’s Law". Journal of the Operations Research Society of America, 2(2), pp. pp. 163–171.
  • Iwo Jima. (2016, July 31). In Wikipedia, The Free Encyclopedia. Retrieved August 5, 2016, from https://en.wikipedia.org/wiki/Iwo_Jima
  • LIND, C. (2009). Verifying Lanchester's Combat Model - Battle of Iwo Jima.
  • MACKAY, N. (2005). "Lanchester Combat Models". Retrieved March, 2011 from http://arxiv.org/pdf/math/0606300.
  • PETZOLDT, T. and RINKE , K. (2007). "simecol: An Object-Oriented Framework for Ecological Modeling in R". Journal of Statistical Software, 22(9), pp. 1–31. ISSN 1548-7660. http://www.jstatsoft.org/v22/i09.
  • R DEVELOPMENT CORE TEAM (2009). R: A Language and Environment for Statistical Computing. R Foundation for Statistical Computing, Vienna, Austria. ISBN 3-900051-07-0. http://www.R-project.org.


If you found this post interesting or useful, please share it on Google+, Facebook or Twitter so that others may find it too.

miércoles, 3 de agosto de 2016

Presentation: Math, Statistics, R programming, online distance education and other topics covered in this blog.

This blog- or rather its predecessor Google site (now defunct)- originally began in 2009 as an auxiliary tool to communicate on-line with my students in the Universidad Nacional Abierta of Venezuela (UNA), a distance education university where I teach math and statistics. The original purpose of that site was to post grades, some bibliography and model exams as well as some announcements- all in all a very modest and limited educational application of information technology. In time, I began to publish some entries dealing with frequently asked questions, but mostly as a time-saving device for me, as I would point my students to this content.

I soon saw that the Google site platform was not so well suited for this purpose and so moved this site to the present blogger platform. I would still continue to use the new blogger site fundamentally as a repository and to post various clarifications of math and statistics related topics that came up in the subjects I teach. Throughout this time, I had become passionate about R programming and its use to learn math and statistics (I myself having benefited greatly in this regard), and so I would occasionally throw in a post or two with examples of R programming to broaden my student's horizons, although still keeping in line with the course contents. Alas, despite these entries (some with very original content in my opinion), my readership did not grow as I intended and the blog very much lay dormant until some time recently.

Although somewhat disillusioned by my blog's traffic and the uninterested reception of these posts among my students, my interest in R programming and its applications in college-level mathematics and statistics education did not waver. For example, I developed an R library called estUNA oriented towards students of statistics courses that could be used on RWeb servers on-line. This would permit students to accomplish the computational activities of the statistics projects and use the data sets issued for the UNA courses each semester, on-line and without having to download and install R on their computers.

The intent of estUNA was to make R use and its characeristic console work flow accessible to students with no programming background and very little computer skills by easy to understand function names in Spanish, by including the datasets directly in the library, thereby relieving the student of complicated data conversion and loading procedures, and even by allowing the student to use R and estUNA on a browser on-line without having to download and install R, let alone additional R packages. Throughout these years, I have blogged about this "R solution" for students in my blog, sometimes with detailed examples of its use in various statistical analyses that are topics dealt with in UNA statistics courses.

Another interesting tool I developed in R is HEVASU. Before going into that, I must very briefly explain the Universidad Nacional Abierta's educational and organizational model. The UNA is a nationwide university distance education institution in which course contents and plans are centralized and created by specialized personnel in Caracas. The actual interactions between students and the institution takes place in local and regional centers across the country where students enroll and consult with professors like myself, who act more as facilitators than as teachers in regular classrooms.

In this distance educational model, students are given books (in paper) and detailed course plans including schedules for presential exams. Thereafter, most of the instruction is self instruction and we teacher/facilitators intervene when the student calls upon us for consultation.  If this seems like a blast to the past for some readers acquainted with MOOCs and more modern ideas of distance education, eLearning, and the like- well, in my opinion it is too, but that is another topic I'll be blogging about in future posts.     

HEVASU was originally an R application I made for myself to simplify the creation of student lists every semester in Excel format for each of my subjects and other associated bookkeeping tasks which makes part of the drudgery of every teacher's profession. Every trimester, we have to fill out activity reports with numbers of how many students came to consultation classified by subjects and undergraduate programs, numbers of graded exams and projects, etc. The original intent of HEVASU was to automate the creation of these reports in Word and pdf formats. In time, I added other functionalities like automated creation of certificates for the UNA introductory course by integrating with LaTeX, all of this in a GUI application done solely in R.

Surely this may strike you as a strange application to do in R, being a language oriented mainly towards statistical and quantitative analysis. Why R and not some other language like Python? Well, it had begun to dawn on me that all this data, collected semester after semester with detailed information about when and which students come to me for consultation on what subjects, when and who comes to take presential exams, what course objectives do they master, etc. was a valuable data to mine and analyze. Surely, I could have still done HEVASU in some other language and the actual statistical analyses in R, but my idea then was to integrate all that into a single application. Nevertheless, in the process I learnt a great deal about GUI programming in R, pdf to text conversion using regular expressions and automated report and certificates generation all which are aspects I'll be blogging about too.

I had by then taken a few MOOCs myself on the topic of Data Analysis and Machine Learning (including an excellent one by Professor Abu Mustafa of Caltech). Additionally, the massive aspect of MOOCs themselves and their potentiality for using student micro-events data to derive powerful educational insights, not to mention the revolutionary global democratization of knowledge that these courses made possible fueled my interest in alternative and emergent paradigms of distance education and my hunger for large data sets on which I could practice these newly acquired techniques. The intent of HEVASU was to produce these large data sets.

This led me to another idea: why not implement formative, quiz-type evaluations on-line to tap into another source of big data? What are the contents and question items most difficult to students about which I should post entries on my blog? What are their patterns for engaging in these on-line quizzes and how does that relate to their eventual success (or failure) in the course? To begin, I chose Mathematics 1, a common course to various undergraduate programs that I believed was critical in student prosecution. I sculpted the quiz generator myself using Javascript and integrated it into this blog.

The on-line quiz system is currently available  here  and if you want to try it out, use my dummy user ID - 12345678 and select the learning objective for the quiz (currently only the first five). After hitting the submit button you'll see a quiz with five multiple-choice questions. After answering (or not) these questions the student will receive detailed feedback on their errors and where they must look in the book for similar problems or clarifications.

This on-line quiz tool significantly boosted traffic to my site. I must say that it is unique in my University and as far as I'm aware of, there's nothing like it even on the Moodle platforms that the UNA's central level is creating for some courses. Besides being of value to my students' learning process, for me it represents a possibility for creating yet another large dataset. All data on which individuals take the quizzes, when, what questions came up, for which objective, what were the answers the student gave for those questions, gets collected real-time in a Google Doc Sheet via Google Forms integration with my site. I'll be blogging here about the process of creating this on-line quiz tool too.

Although my traffic has increased dramatically, I must say I'm still not happy with my blog. Recently I've come to the realization that blogging about my personal experiences and continuing learning process in using computer technology for instructional and educational purposes, specifically in a distance education environment might be of interest to a wider global audience. To do that, I had to broaden my blog to make it bilingual. While still tending to my UNA public in Spanish, I will now also write to an English-speaking audience.

I realize that all this story about how I basically crafted my own technological solutions to instructional problems by a process of trial and error may strike you as a re-invention of the wheel. Maybe in other universities or educational institutions (distance or not), the computer tools are already created and there's not much for the facilitator to do but to apply them.

Even so, this could be of value to you because: 1) It proves that an you as an individual, without having a whole IT department at your disposal, can create this using commonly available and free technology, 2) this allows you to tap into the data that you and your students generate, 3) you can tailor these tools to your particular educational setting and 4) this will enable people, both teachers and students, in underdeveloped countries to become actors in global knowledge economies. But my approach comes at a cost- you have to be willing to learn a little bit more beyond office applications use. You have to be willing to learn how to code. Nonetheless I assure you your efforts will be paid off.

Of course, I'll also be blogging to students, presenting various case studies in math, statistics and even other subject areas with a computational approach (using R) which they themselves can explore and engage in, or simply blogging about math and statistics topics which commonly pose difficulties to college students. I'll also be blogging about data visualization topics and the use of state of the art quantitative techniques available in the extensive R package system as I come into contact and begin to learn about these myself. This is quite an ambitious and formidable blogging program, to be sure. So when does this blog begin? It begins right now!

domingo, 31 de julio de 2016

¿En qué consiste la inferencia estadística? Protocolo de inferencia estadística - parte 1

La primera parcial de la asignatura de Estadística Aplicada (746) contempla los primeros cuatro objetivos, todos relacionados con el tema de inferencia estadística. Bien sea si realizamos inferencia por medio de intervalos de confianza (objetivo 1), contraste de hipótesis de una población (objetivo 2), contraste de hipótesis de dos poblaciones (objetivo 3) o tests de bondad de ajuste o con tablas de contingencia utilizando estadísticos chi-cuadrado (objetivo 4), hay un procedimiento (protocolo) que debemos seguir para resolver los problemas de inferencia estadística que se presentan en la evaluación de estos objetivos. Continuen leyendo más abajo para ver de que se trata.

inferencia.gif

lunes, 25 de julio de 2016

Trabajo práctico de la 745, lapso 2016-1

Como seguramente ustedes saben, los trabajos prácticos de estadística pasaron a ser evaluaciones formativas desde hace algunos semestres. A partir de entonces, el objetivo 1 de Estadística General (745) se evalúa en la primera parcial y en la integral. Aunque ya no es necesario entregar un trabajo práctico cómo tal ni recibirá una calificación departe mía, yo les recomendaría realizar las actividades contempladas en el enunciado del trabajo, que fueron publicadas aqui. La razón de mi recomendación es porque en este semestre, las actividades del trabajo práctico contemplan la elaboración de diagramas de caja y de torta. Mi olfato docente me obliga a avisarles sobre esto e invitarlos a que continúen leyendo esta entrada, donde realizaremos juntos las actividades propuestas, no vaya a ser que las gráficas de tortas y de caja los agarren desprevenidos este semestre...


jueves, 21 de julio de 2016

Métodos de Redondeo (Objetivo 1 de Matemáticas I)

En esta entrada del blog voy a abordar el tema del redondeo, que es contenido del objetivo 1 de Matemáticas I referente al estudio de los números racionales, sus operaciones y propiedades. Pienso que este tema, a pesar de su aparente sencillez, merece una revisión porque, cómo les voy a contar, hasta hace algún tiempo yo mismo tenia una concepción errónea del método de redondeo.


martes, 19 de julio de 2016

Trabajos de Estadística (738/748, 745 y 746) Lapso 2016-1

Se ha publicado los enunciados para los trabajos prácticos de las siguientes materias: 738/748, 745 y 746. Ante todo permítanme aclararles que estos trabajos prácticos son actividades de evaluación formativa y como tal, no tienen fecha de entrega ni ponderación en la calificación final de la materia. Aún así, les recomiendo revisar los enunciados e intentar realizar las actividades que allí se piden. Los enlaces a las carpetas comprimidas con la data y los enunciados en ciberesquina se dan a continuación:

738/748
745
746

Trataré en próximas entradas de abordar las actividades contempladas en esos trabajos. Por los momentos, les recuerdo que pueden utilizar el lenguaje R para realizar las actividades ustedes mismos. En una página fija de este blog se da información para aquellos interesados en usar R. En este mismo blog he publicado video tutoriales sobre cómo instalar R y la librería estUNA así como un ejemplo del empleo de técnicas de estadística descriptiva. También encontrarán muchas entradas ilustrando distintos métodos de estadística en este programa.

Para este semestre, la data se encuentra en el siguiente data frame de estUNA: d20161

Si te gustó o te pareció útil este contenido, compártelo en las redes sociales y dale tu voto positivo en el botón "me gusta" de G+, para que otros puedan encontrar el contenido también.

miércoles, 15 de junio de 2016

Talleres para el semestre 2016-1

Matemática I (175-176-177)


Taller 1Inducción25/06/20168am-12pm
Taller 2Unidades 1 y 202/07/20168am-12am
Taller 3Unidades 3 y 409/07/20162-5pm
Taller 4Unidades 5 y 616/07/20168am-12pm
Taller 5Unidad 702/09/20168am (sede UNA)
Taller 603/09/20168am (sede UNA)


Los talleres de Matemática I serán dictados en el Trujillo. Estén atentos a la publicación de fechas de los siguientes talleres.

Estadística General (745)


Taller 1Objetivos 1-416/07/20169am-12pm
Taller 2Objetivos 5-817/09/20169am-12pm
Taller 3Objetivos 1-822/10/20169am-12pm
Taller 4Objetivos 1-805/11/20169am-12am

Estadística Aplicada (746)


Taller 1Objetivos 1-423/07/20169am-12pm
Taller 2Objetivos 5-824/09/20169am-12pm
Taller 3Objetivos 1-829/10/20169am-12pm
Taller 4Objetivos 1-812/11/20169am-12pm

miércoles, 1 de junio de 2016

Publicación de objetivos logrados

A partir de este semestre 2016-1, la consulta de los objetivos logrados en las materias que asesoro se hará de una manera distinta a como se venia haciendo. Anteriormente, el estudiante navegaba hacia la página de la asignatura cuyos resultados de evaluación quería consultar (ej. Matemática I, Estadística General, etc.) y hacía clic sobre el enlace de objetivos logrados, desde donde se abría una ventana con los objetivos logrados de la nómina completa de estudiantes para esa asignatura.