## On Monument Volume II

April 10, 2013

The previous post suggested that mound shape could be modeled as a spherical cap. I then proposed that the shape of those mounds may change through time, due to weathering and repeated plowing by modern agricultural equipment, but mound volume might remain the same. As illustrated in the following figure, mounds might become shorter but wider as they are weathered and plowed. In the figure, A represents the original mound shape, while B reflects mound shape after weathering and plowing. The height, h, has decreased over time, while the radius, a, has increased.

Other hypotheses are possible, but I will evaluate this scenario first.

I have compiled museum data on mound condition and mound size for all recorded mounds in my study region. The museum records characterize mound condition as either “whole” or “plowed”. The records did not disclose the basis for this characterization. These records also document mound height and width. For each mound, I calculated a volume, assuming that mound shape resembles a spherical cap. The following two histograms illustrate the distribution of mound volume for plowed mounds and for whole mounds.

As you can see, the distributions of mound size for plowed and whole mounds look very similar. A few outliers may occur at the right tail of both distributions. These outliers represent unusually large mounds. The similarity of the histograms suggest that a single probability distribution could be used to model monument volume. The next post will evaluate monument volume more rigorously.

© Scott Pletka and Mathematical Tools, Archaeological Problems, 2013.

## On Monument Volume I

March 26, 2013

This post introduces an approach for evaluating the original size of round burial mounds. In one of the places where I’ve worked, burial mounds comprise a prominent feature of the landscape, as illustrated in the following photograph.

This prominence may be amenable to explanation through formal high-level theory. Mound size, for example, may reflect the labor used to produce it, suggesting something about the size and organizational capabilities of the group that produced the mound. In order to use this feature of the monuments to evaluate high-level theory, the modern size should be an accurate reflection of the original size.

Such monuments may erode over time, making them less conspicuous and also less reliable as an index of the characteristics of the group that produced them. Natural weathering may take its toll, but modern agricultural practices probably affected burial mounds to a greater extent. Burials mounds were sometimes plowed repeatedly. These modern practices came later to the region where my case study is located, by which time laws protecting them had been enacted. Nevertheless, various processes leveled many mounds, perhaps decreasing their height and increasing their diameter. Despite these depredations, the original volume of the mounds may be preserved.

Mound shape can be modeled as a spherical cap, a geometric form representing the portion of a sphere above its intersection with a plane. Spherical caps are thus dome-shaped. The following figure illustrates a spherical cap. In the figure, h is the height of the dome, a is the radius of the dome’s base, and R is the radius of the sphere.

The total volume of a spherical cap depends on the maximum dome height, h, and on the radius of the circle where the plane intersects with the plane, a. The formula for the volume, V, of a spherical cap is:

$V=(\frac{1}{6})\pi h(3a^2+h^2)$

Importantly, the calculation of the volume of a spherical cap does not depend on the radius of the sphere of which it is a part. The maximum possible original height of a mound, however, should be equal to the radius of that sphere. This height can be calculated by holding the volume constant and finding this value of the height and radius. At that point, the height and radius will be equal. Subsequent posts will explore these ideas further and play with some data on mound size.

© Scott Pletka and Mathematical Tools, Archaeological Problems, 2013.

## A Useful Resource for Understanding Combinatorics and Probability Theory

January 19, 2011

Combinatorial principles can be difficult to understand from modern textbooks. The more elegant the explanation, the more it is couched in abstract mathematical language. A book that I picked up a long time ago has helped me to bridge the gap between those elegant, abstract textbook explanations and a concrete understanding of them. The book Lady Luck by Warren Weaver provides a relatively rigorous explanation of probability in plain, clear language. I have turned to this book many times to supplement my textbooks when the textbook explanation of a concept proved elusive.

© Scott Pletka and Mathematical Tools, Archaeological Problems, 2011.

## Off-topic: Career Paths in Archaeology

January 17, 2011

In this post, I will again digress, slightly, to discuss possible career paths in archaeology. I addressed an aspect of this issue in my earlier posts on graduate school,which gave some of my thoughts on preparing for an academic career. This time, I’ll talk more generally about possible career trajectories and ways to prepare for them. This discussion will serve as an introduction to subsequent posts, which will detail my own efforts to chart a particular career path.

I have observed a couple pathways to career “success” in archaeology. I define success in terms of acquiring a steady job doing something close to the kind of work for which you prepared yourself in graduate school and through subsequent work experience. One pathway I would consider a high risk, high reward strategy. The other pathway entails lower risks and commensurately lower rewards. I’ll discuss the high-risk strategy first.

The greatest excitement in archaeology generally comes from fieldwork which sheds new light on an old problem or fieldwork which identifies new problems to be solved. Fieldwork also provides opportunities to find the first, oldest, youngest, largest, smallest or whatever-superlative that’s-ever-been-found. In any case, fieldwork remains key to generating high levels of enthusiasm and support for the work that an archaeologist is doing. This simple fact is reflected in many (but, certainly, not all) of the job postings for academic jobs in archaeology. Most job descriptions for such positions will identify an ideal candidate as a person who, among many other things, has an active program of field research. The sad truth is that few people get famous (or secure academic positions) researching old collections. What makes this truth so sad is that a lot of archeological data already exists, is available for research, and has been incompletely reported. In some parts of the world, collection facilities don’t have room for many new collections. And yet the imperative exists to keep surveying and keep digging.

Thus, candidates for academic jobs would generally be wise to develop an active field research program. I consider this a high-risk strategy, however, because there’s little guarantee that the work will provide truly novel data that speaks to interesting problems or that leads to new questions or that results in the discovery of the first, oldest, youngest, largest, smallest or whatever-superlative that’s-ever-been-found. Certainly not if the archaeologist in question is working in a place like Mesoamerica, which can seem like an archaeological theme park, with hordes of professors, students and volunteers in tow, wafting through each field season. More likely, all that hard work (and fieldwork can be incredibly labor-intensive) will make a modest, incremental contribution. Such contributions will not likely move the meter sufficiently to impress an academic search committee, no matter how well-formed the underlying research design.

Taking this path therefore risks producing a highly competent but rather generic field archaeologist, destined to manage projects in the CRM world. Not that there’s anything wrong with that, as long as that the prospective candidate anticipated and planned for that career path. It’s unlikely, however, that an archaeological student who trained as a Mesoamerican/European/Andean/your-culture-area-here specialist will end up working solely in that particular area during the course of a CRM career. Frustration thus ensues.

The other, lower-risk career path is to specialize in a technical discipline, such as zooarchaeology, geophysical prospecting, underwater archaeology, chemical analysis, or quantitative methods. Sometimes academic jobs are posted specifically for these specialties, but such postings are relatively rare. A demand always exists for the services of these specialists, however, as consulting members of academic research programs or as suconsultants on CRM projects. For individuals with the appropriate training, opportunities exist to work in the exact specialty for which the archaeologist trained. Thus, this career path is likely to entail less frustrations: the specialist training provides appropriate additional research opportunities. Of course, such specialists also generally work in support of another archaeologist’s project and not on projects of their own devising.

© Scott Pletka and Mathematical Tools, Archaeological Problems, 2011.

## Off-topic: Archaeomath’s Guide to Success in Graduate School for Archeology II

January 19, 2010

In my previous post, I detailed some things that prospective graduate students should do to prepare themselves for graduate school. In this post, I tackle the graduate years. The tips are focused on things that you should do while you are still in graduate school to improve your future academic job prospects.

Tip Group 2 – Early Years of Graduate School. During these years, you will be satisfying course requirements, obtaining funding (if you didn’t already snag some), and developing and writing a Master’s thesis. If you are serious about an academic career, you will begin establishing your qualifications for such a career at this point. One of the more important credentials will be your publication record.

• Tailor your coursework to your thesis research. Work with each professor to tie your class paper or project to a chapter or portion of that thesis.
• Scale your thesis project to a level of effort sufficient to produce one publishable article. Save the book-length monograph for your dissertation. Anything longer than 50 double-spaced pages will require extensive trimming prior to publication in journal.
• Work with an existing artifact assemblage or data for your thesis. Ideally, you should only spend a couple years working toward your Master’s degree. To meet this schedule and produce a publishable thesis, you would be very hard pressed to acquire enough data through fieldwork to write a thesis worth publishing.
• Don’t waste your time going to a lot of conferences if you don’t have a paper to present. Conferences are a good way to catch up with people you haven’t seen in long time. Conferences are not terribly useful for networking, if you don’t have a paper to present. Let’s face it: many archeologists are not that good at this kind of interaction. If they really wanted to talk with people, they wouldn’t study human behavior through the lens of their garbage.
• Go to conferences if you are ready to present your thesis or if you will be giving a paper with your advisor.
• Give poster presentations rather than speaking at a session, unless you have been invited to speak at an organized session. General sessions are not likely to attract enough people interested in your research to make it worth your while. In addition, the main focus at many sessions is keeping the session on schedule. Discussion opportunities are inevitably more limited. With a poster, you will have a much greater opportunity to actually talk with people.
• Get some CRM training. You may need to go outside your own institution to get it. As noted previously, most archeologists ultimately work in CRM and not in academia. Scoff if you like, but that’s the reality. It’ll probably be your reality, if only for a couple years before you can land that sweet academic job. You’ll be much happier if you actually know what you’re supposed to be doing. Learn the regulatory process and how it applies to archeology.

Tip Group 3 – Mid-Career Graduate School. During these years, you will be publishing your Master’s thesis, developing your dissertation project, finding funding for your research, and initiating your dissertation fieldwork. This time is the crucial period for establishing your academic credentials through a solid publication record.

• Focus your early solo publication efforts on niche or regional journals. Contributions to edited volumes are also an acceptable venue for your early efforts. Like it or not, your reputation (and lack thereof) will matter when people review your work. Everyone would love to have their first publication be in Current Anthropology or Nature, but that goal is not realistic for most people. Start small at first. Then build on that work in subsequent publications.
• In a similar vein, focus your early papers on presentations of new data. This kind of paper is easiest to generate and hardest to reject. Your work needs to be theoretically-informed, obviously. There will be reviewers, however, who scoff at the presumption of a newbie who’s trying to publish some Grand Theory of Stuff. Establish your track record as a diligent scholar before trying to impress the old silverbacks with your credentials as an innovative scholar.
• Collaborate with your advisor. Your Grand Theory of Stuff will be much more likely to gain acceptance if you co-author it with another established silverback.
• Work on a field project for your dissertation that can be spun into future field projects. In addition to a successful record of publications, prospective academic employers want to know that you can provide field and research opportunities for their students. I wouldn’t, for example, join an established field project at its tail end unless you’re confident that you can make a go of it on your own.
• Do a little CRM work on the side. If you’ve made it this far in school, you could probably use the money. As noted, you are also likely to end up working in CRM. The contacts and experience that you obtain working a few local CRM jobs will be valuable later, if your pursuit of an academic job is unsuccessful.

Tip Group 4 – End of Graduate School. During these years (which may last a long time), you will be analyzing field data, writing your dissertation, preparing for your future career,. and submitting job letters for open positions. If you haven’t already started to establish your publication record, you may have very little opportunity left to do so, depending on how long you take to write your dissertation.

• Don’t be in a rush to graduate, unless you have severe financial constraints. The clock on your viability as an academic job applicant will be ticking once you’ve graduated. If you haven’t landed that first academic job within the first three or four years of graduating, you aren’t likely to get one. At that point, most schools will figure that you’ve been rejected for other opportunities for good reason.
• Organize a session at a major conference around a topic that is central to your dissertation work. This session will give you a little extra visibility prior to graduation. If successful, you may also be able to organize an edited volume around the proceedings.
• Turn your dissertation’s “theory chapter” into a publishable article. At this point, you presumably have a publication record going for you. Hopefully you now also have enough credibility and a sufficiently strong paper to get your work accepted in a major journal. Having just one article in a major journal at this stage will provide a significant boost to your chances of getting interest on the academic job market.
• Try to find teaching opportunities available to ABD candidates and obtain a few part-time teaching gigs. Local community colleges may provide such opportunities, in addition to the spots available at your own university. Prospective academic employers will want to know what classes you’ve taught and are prepared to teach. If you can establish your ability to teach a diverse range of classes to a diverse audience, with documentation of teaching efficacy (good class evaluations), you will give your academic job chances another boost.
• Once you’ve graduated, apply for any limited (one-to-two-year) appointments as a university lecturer for which you are qualified. You can often turn this experience into a full-time gig somewhere. Of course, you need to be sufficiently mobile to make this kind of short-term move.
• Start dialing your friends at local CRM firms. You may need a place to hang your hat while applying for academic jobs. And you may need to settle on CRM as a long-term career path.

Hopefully, you find these suggestions useful. Maybe they seem obvious, but I certainly didn’t think strategically about my career while I was in graduate school. My lack of forethought definitely shaped my prospects once I was finished.

© Scott Pletka and Mathematical Tools, Archaeological Problems, 2010.

## Off-topic: Archaeomath’s Guide to Success in Graduate School for Archaeology I

January 18, 2010

I’ve had a few thoughts on strategies for success in graduate school (and beyond) rattling around in my head for a number of months. Since they won’t do me any good, as I’ve long since concluded that phase of my life, I’m posting these thoughts here. You may wonder what credibility I have as an expert on this topic. As noted, I did complete graduate school, and I have had the opportunity to compare my experiences to those of my colleagues. Beyond those credentials…Dude, you’re the one googling for tips on this subject, so my credibility is probably not your foremost problem.

My advice is predicated on the notion that you care about your future once you’ve graduated and you think you want to teach. I personally did not give a great deal of thought to life after school. I just really wanted to do archaeology, and I had a vague notion that I might get a teaching job after I’d finished school. Things worked out alright for me, I guess, but I wouldn’t recommend my cavalier approach to you. I have grouped my tips by the order in which you should undertake them during your graduate career.

Tip Group 1 – Preparing for Graduate School. To get the most out of your graduate-school experience, you should prepare for it before you enter. These tips will be most helpful if you are still an undergraduate. If not, you may be able to undertake some remedial training and other actions to get up to speed.

• Get training in soils, geomorphology, statistics, and GIS. Having knowledge in these topics will give you tools for fieldwork and laboratory analyses, regardless of the areas where you will work and the issues that you will study.
• Get diverse field experience. Take a couple field schools in different parts of the world. It will give you exposure to some different ways of running projects and to the methods appropriate to different settings.
• Work as a field and laboratory technician for a cultural resource management (CRM) firm. Temporary and permanent positions as a field and laboratory technician are open to anyone with a bachelor’s degree and a little prior field and laboratory experience. Experience at a CRM firm will serve multiple purposes. It will give you a valuable perspective on your commitment to archeology. It will allow you to hone your craft as a field worker, so you can enter graduate school prepared to conduct your own field work. And it will provide you with some sense of a possible future career track. Most archeologists ultimately work in some facet of CRM. Very few archeologists teach at a university.
• Page through major journals and the programs for some of the major conferences to identify current topics of interest to the field. As much as I’d like to believe that it would still be possible for you to set the (archaeological) world on fire if you have a well-developed but esoteric interest in—for example—cogstones, I have my doubts. Archaeology is like any other field of study, subject to trends and fancies. Make sure that your research interests are relevant to contemporary concerns in the field. Otherwise, you will have a hard time getting accepted at a good graduate school, attention for your research, major publications, and a decent job.
• Commit to working in an area that will allow you to distinguish yourself. Sorry to say, but the world has enough Mayan archaeologists. Mayan archaeology may very well have been the subject that first drew you to the field, as it did many others. Your chances of landing that sweet teaching job as a Mayan archaeologist, however, are not high, despite the number of jobs open to people with that specialty. Plenty of other complex societies left an archeological record worthy of study. Try one of them.
• Develop a tentative plan for your graduate work. By the time you enter graduate school, ideally, you will have some notion of the topics on which you would like to work. The more focused you can be, the more effective your time in school will be.

In an upcoming post, I’ll provide some tips for your early years in graduate school.

© Scott Pletka and Mathematical Tools, Archaeological Problems, 2010.

## More on Mixture Models, Maximum Likelihood, and Direct Search Methods

January 15, 2010

This post describes some issues that I encountered while trying to calculate likelihood values using the direct search approach. Direct search methods calculate the likelihood value for each specified parameter combination and compare that value to the values of all other specified combinations. This approach has the advantage of simplicity, but it requires careful consideration of the parameter values for which likelihood values are to be calculated and compared.

Consider a model with three variables. A likelihood value can be calculated for any particular combination of parameter values. By systematically varying the values of these three parameters, a three-dimensional picture of likelihood values can be created that shows how the likelihood responds to changes in parameter values. Local peaks or optima in likelihood values may exist in addition to the maximum likelihood value found at the combination of parameter values that constitutes the maximum likelihood estimates for those parameters. Direct search methods may avoid being fooled by local optima in likelihood value under certain conditions.

Two conditions must be satisfied to avoid settling at local optima. First, likelihood values should be calculated at sufficiently at narrow interval of the values for each parameter. Narrow intervals ensure that the calculation of likelihood values does not skip over parameter values that are at or close to the maximum likelihood estimates. In addition, the range of values explored for each parameter must be sufficiently broad to encompass the maximum likelihood values.

The direct search approach often requires that a balance be struck between precision and power. Choosing narrow search intervals and a broad range of values over which to search provides greater opportunities to find the maximum likelihood estimates or values close to them. The cost of employing narrow search intervals and a broad range of values is computing time. Narrowing the interval or broadening the range increases the number of parameter value combinations for which likelihood values must be computed, slowing the process of finding the maximum likelihood estimates. Searching over too broad a range of parameter values also risks other potential problems.

My work modeled fish vertebrae size-frequency data as a mixture of two lognormal distributions. For my data, the direct search method would sometimes find that the maximum likelihood estimates included a distribution with a very small log standard deviation (less than 0.05). Such estimates occurred when one distribution represented a small proportion of the mixture distribution (less than 0.25). For convenience of reference, I have termed these fitted distributions as “vestigial” distributions; they are part of the mixture distribution but don’t add much information to it.

These results seem analogous to the “overfitting” that occurs when a model with an unnecessarily large number of parameters is fit to the data. Models with large numbers of parameters will likely fit the current data very well but will be unable to fit future data sets accurately. Some of the model terms are likely to be accommodating noise in the data and not the process of interest. Similarly, cases where the maximum likelihood method results produce a vestigial distribution may indicate that the vestigial distribution is primarily accommodating some noise in the data. The resulting estimates for the mixture distribution do fit the data. My suspicion, however, is that this mixture distribution would fit another sample from the same population poorly.

Results that included these vestigial distributions also seem unrealistic. Under what circumstances would one portion of the mixture distribution have such a small log standard deviation, so all the individuals from that distribution are essentially of the same size? Such occurrences could possibly result if the data was not generated by independent processes. This circumstance could apply to my fish vertebrae data if I was I not successful in screening out multiple vertebrae from the same individual fish from my data set.

The vestigial distributions were most likely to be generated when modeling data sets with relatively small sample sizes. This pattern suggests that they do derive from noise in the data. I would otherwise have a hard time explaining variability in the occurrence of these vestigial distributions. For most of my assemblages, both components of the mixture distributions had relatively large log standard deviations.

I thus constrained the direct search to only consider distributions with a log standard deviation greater than 0.07. With this constraint in place, the mixture distribution model produced results that seemed reasonable and realistic. In most cases, the mixture models produced a significantly better fit to the data than a single lognormal distribution. The exceptions occurred, as might be expected, in the case of assemblages with relatively small samples sizes.

© Scott Pletka and Mathematical Tools, Archaeological Problems, 2010.

## Mixture Models, Maximum Likelihood Methods, and Confidence Intervals

December 19, 2009

In an earlier post, I noted that the parameter estimates for a mixture model supplied by maximum likelihood methods were only part of the story. A measure of the precision of those estimates is also needed. Confidence intervals provide this measure. This post details a method for determining them.

Packages for the analysis of mixture models in R like mixdist generate confidence intervals automatically. The direct search approach, however, has proven to be more reliable for the data sets that I have been examining. In a direct search, the likelihood is calculated for each combination of parameter values over a plausible range of those parameter values.

The likelihood value of each combination is calculated by looping over a sequence of parameter values for each parameter. The interval between the values of a parameter used in the calculations should be relatively small. When small intervals are used, however, the number of combinations of parameter values for which likelihood values must be calculated increases rapidly. Direct search of the parameter space may not be practical for some applications. The direct search approach requires that a balance be struck between precision and manageability.

I have provided some R code that can be used, with some additional work, to generate confidence intervals for parameters of a simple mixture model. The mixture model assumes that the data comprises two lognormal distributions. Confidence intervals for the proportion of cases in the first model can be determined from the results produced by the code as written; the code can be modified to generate results relevant to other variables. The code follows:

## Identifying and Explaining Intensification in Prehistoric Fishing Practices XII: Specific Hypotheses to Explain Variation in Net-Use

November 28, 2009

The previous post in this series presented some high-level theory that might account for variation in fishing intensification and, thus, net use. This theory will now be tailored for my study area to generate some specific expectations. As noted elsewhere, I will not be dwelling on the details of the site and study area except as necessary to explain how I arrived at particular predictions.

The archeological assemblages that I have been analyzing derive from a single shell midden site. The analyzed deposit ranges from 15 to 55 centimeters below the ground surface. The site was excavated in five-centimeter arbitrary levels. I have treated each arbitrary level as a distinct analytic unit, which seems reasonable as spatial analysis of radiocarbon dates and other chronologically-diagnostic artifacts show very little vertical mixing or movement of artifacts. Poor environmental conditions appear to have occurred during the time period in which three levels–located between 35 and 50 centimeters below the ground surface–were deposited.

The period is characterized by widespread drought. These conditions disrupted settlement at many other sites. My site is one of the few sites in the region to have been continuously occupied during the period. The site lies near the mouth of a creek, an important source of fresh water.

Marine productivity may also have declined during the period of poor environmental conditions. Paleoenvironmental data regarding ocean conditions are complex and not entirely consistent. Proxy data derived directly from archaeological sites within the region, however, shows that sea surface temperatures during the period of drought were unusually high. These conditions may have affected the distribution and abundance of fish.

A variety of social and economic responses to the challenges of the period of poor environmental conditions have been documented. Economic specialization in artifact production emerged at my site and across the region. Local manufacturers produced trade goods. In exchange for these goods, these specialists presumably received food and other items that could not be produced locally as easily. Fishers at my site may have responded by changing their fishing strategies. The number of fish caught by the site’s inhabitants seems to peak during the interval of poor environmental conditions before declining.

This observation is consistent with other faunal analyses of the site’s deposits, but it could be attributable to a number of different factors. The peak in density of fish remains could be due to an increase in population at the site during the period of poor environmental conditions. The site may have served as a refuge for groups from elsewhere in this period, since fresh water was more readily available at the site. The increase in the density of fish remains could reflect a more widespread emphasis on fishing by the site’s inhabitants as other foods normally taken by them became less abundant. It could be attributable to increased economic specialization. Fish may have subsidized on-site specialized artifact production. Workers at the site may have specialized in both artifact production and fish procurement, as the local inhabitants had comparative advantages in these activities and exchanged their wares and fish for other goods. The greater density of fish could also be due to some quirk of cultural transmission, as fishers made choices about the appropriate gear to use and effort to undertake based on the work being done by their neighbors. A more detailed examination of the data will allow these possibilities to be distinguished.

© Scott Pletka and Mathematical Tools, Archaeological Problems, 2009.

## More Thoughts on Mixture Models and Maximum Likelihood Methods

November 11, 2009

In my previous post on this topic, I discussed two techniques for finding the combination of mixture distribution parameters that have the lowest log likelihood, direct search and the mixdist package for R. I suggested that direct search of the parameter space allowed the effects of outliers in my data to be identified more clearly. I have done additional work since that time, comparing direct search and the mixdist package. As a result of this work, I have concluded that direct search is much more effective at finding the optimal combination of parameter values.

Mixdist returned parameter values that consistently produced higher log likelihoods than I found using direct search. The differences were substantial. I can not fully explain the observed differences, but the differences were also consistent among all of my data sets.

Direct search of the parameter space is obviously not the most convenient approach. My model involved only two lognormal distributions with a total of five parameters. Direct search of the optimal parameters for more complex mixture models may not be feasible, as the number of parameter value combinations that need to be searched is too large. For simple mixture models, however, the direct search may be preferable.

The following code is the very simple program that I wrote for R to find the lowest log likelihood and corresponding parameter values. The program was written specifically for a mixture model of two lognormal distributions. The parameter value search space included the range of likely values of log mean of fish vertebra height and the log standard deviation of fish vertebrae height in both of the two distributions. I am not a professional programmer, as you will see, so any suggestions for improving and extending the code will be greatly appreciated.

#vcdata is a list of the data for which the parameter estimates and likelihood will be calculated

#pvec provides the sequence of values for the proportion of vertebrae in the mode of smaller (net-caught) fish over which the program loops.

pvec=seq(0.10, 0.99, by=0.015)

#mean1vec provides the sequence of values for the log mean of vertebra height in the mode of smaller (net-caught) fish over which the program loops.

mean1vec = seq(0.80, 1.20, by = 0.03)

#sd1vec provides the sequence of values for the log standard deviation of vertebra height in the mode of smaller (net-caught) fish over which the program loops.

sd1vec=seq(0.02, 0.44, by=0.03)

#mean2vec provides the sequence of values for the log mean of vertebra height in the mode of larger (hook- or spear-caught) fish over which the program loops.

mean2vec=seq(1.25, 1.70, by=0.03)

#sd2vec provides the sequence of values for the log standard deviation of vertebra height in the mode of larger (hook- or spear-caught) fish over which the program loops.

sd2vec=seq(0.02, 0.44, by=0.03)

#loglike is the negative log likelihood, which is calculated for each combination of parameter values.

loglike=100000

#p stores the parameter value for the proportion of vertebrae in the mode of smaller (net-caught) fish.

p=0

#mean1 stores the parameter value for the log mean of vertebra height in the mode of smaller (net-caught) fish.

mean1=0

#sd1 stores the parameter value for the log standard deviation of vertebra height in the mode of smaller (net-caught) fish.

sd1=0

#mean2 stores the parameter value for the log mean of vertebra height in the mode of larger (hook- or spear-caught) fish.

mean2=0

#sd2 stores the parameter value for the log standard deviation of vertebra height in the mode of larger (hook- or spear-caught) fish.

sd2=0

#the result data frame returns the value of the log likelihood at a particular combination of parameter values

result<-data.frame(loglike, p, mean1, sd1, mean2, sd2)

#the finalresult data frame stores the log likelihood and parameter values for the combination of parameter values that returns a log likelihood that is smaller than all other log likelihoods generated.

#looping over the combination of parameter values

finalresult<-data.frame(loglike, p, mean1, sd1, mean2, sd2)

for (j in 1:length(mean1vec)) {

for (k in 1:length(pvec)) {

for (m in 1:length(sd1vec)) {

for (n in 1:length(mean2vec)){

for (q in 1:length(sd2vec)){

#the following function returns the negative log likelihood value at a particular combination of parameter values

L= -sum(log(pvec[k]*(dlnorm(vcdata, meanlog=mean1vec[j], sdlog=sd1vec[m]))+(1-pvec[k])*(dlnorm(vcdata, meanlog=mean2vec[n], sdlog=sd2vec[q]))))

result$loglike=L result$p=pvec[k]

result$mean1=mean1vec[j] result$sd1=sd1vec[m]

result$mean2=mean2vec[n] result$sd2=sd2vec[q]

#the following comparison stores the lowest log likelihood and the corresponding combination of parameter values seen up to this point

if (L<finalresult\$loglike) finalresult=result

}

}

}

}

}

finalresult

When I employed the direct search, I ran it twice for each data set. The first time, I looped over a wider range of parameter values. The sequence of parameter values searched within each variable was spaced sufficiently far apart so the direct search would not bog down. The one exception was the proportion of fish vertebrae in each mode. For this variable, the step-size between the values of proportion for which I calculated the log likelihood was fairly small from the start. Experience with my data sets showed that this variable had the biggest effect on the log likelihood.

The second time that I ran the direct search for each data set, I focused on a narrower range of parameter values. The range of parameter values that I searched centered around the values found in the initial run. The sequence of values searched within each variable was spaced closer together in the second run.

Additional code, of course, needs to be written in order to determine the standard errors of the parameter estimates.

© Scott Pletka and Mathematical Tools, Archaeological Problems, 2009.