SDGB 7844 HW 3: Capture-Recapture Method

SDGB 7844 HW 3: Capture-Recapture Method
Due: 10/31
Submit two files through Blackboard: (a) .Rmd R Markdown file with answers and code
and (b) Word document of knitted R Markdown file. Your file should be named as follows:
“HW3-[Full Name]-[Class Time]” and include those details in the body of your file.
Please submit your solutions only once! Complete your work individually and comment your
code for full credit. For an example of how to format your homework see the files related to
the Lecture 1 Exercises and the RMarkdown examples on Blackboard. Show all of your
code in the knitted Word document.
In the beginning of the 17th century, John Graunt wanted to determine the effect of the
plague on the population of England; two hundred years later, Pierre-Simon Laplace wanted
to estimate the population of France. Both Graunt and Laplace implemented what is now
called the capture-recapture method. This technique is used to not only count human populations
(such as the homeless) but also animals in the wild.
In its simplest form, n1 individuals are “captured,” “tagged”, and released. A while later,
n2 individuals are “captured” and the number of “tagged” individuals, m2, is counted. If N

SDGB 7844作业代做、代写R编程设计作业
is the true total population size, we can estimate it with NˆLP as follows: This is called the Lincoln-Peterson estimator1.
We make several strong assumptions when we use this method: (a) each individual is
independently captured, (b) each individual is equally likely to be captured, (c) there are no
births, deaths, immigration, or emigration of individuals (i.e., a closed population), and (d)
the tags do not wear off (if it is a physical mark) and no tag goes unnoticed by a researcher.
Goal: In this assignment, you will develop a Monte-Carlo simulation of the capture-recapture
method and investigate the statistical properties of the Lincoln-Peterson and Chapman es-
1
Interestingly, this estimator is also the maximum likelihood estimate. As you probably guessed, more
complex versions of this idea have been developed since the 1600s.
1
timators of population size, N. (Since you are simulating your own data, you know the true
value of the population size N allowing you to study how well these estimators work.)
Note: It is helpful to save your R workspace to an “.RData” file so that you don’t have to
keep running all of your code every time you work on this assignment. See Lecture 8 for
more details.
1. Simulate the capture-recapture method for a population of size N = 5, 000 when n1 =
100 and n2 = 100 using the sample() function (we assume that each individual is
equally likely to be “captured”). Determine m2 and calculate Nˆ
LP using Eq.1. (Hint:
think of everyone in your population as having an assigned number from 1 to 5,000, then
when you sample from this population, you say you selected person 5, person 8, etc., for
example.)
2. Write a function to simulate the capture-recapture procedure using the inputs: N, n1,
n2, and the number of simulation runs. The function should output in list form (a)
a data frame with two columns: the values of m2 and Nˆ
LP for each iteration and (b)
N. Run your simulation for 1,000 iterations for a population of size N =5,000 where
n1 = n2 = 100 and make a histogram of the resulting Nˆ
LP vector2
. Indicate N on your
plot.
3. What percent of the estimated population values in question 2 were infinite? Why can
this occur?
4. An alternative to the Lincoln-Peterson estimator is the Chapman estimator:
Use the saved m2 values from question 2 to compute the corresponding Chapman estimates
for each iteration of your simulation. Construct a histogram of the resulting NˆC
estimates, indicating N on your plot.
5. An estimator is considered unbiased if, on average, the estimator equals the true population
value. For example, the sample mean x =Pni=1 xi/n is unbiased because on
average the sample mean x equals the population mean µ (i.e., the sampling distribution
is centered around µ). This is a desirable property for an estimator to have because
it means our estimator is not systematically wrong. To show that an estimator ˆθ is
2Basically, you are empirically constructing the sampling distribution for NˆLP here. Remember the
Central Limit Theorem which tells us the sampling distribution of the sampling mean? Each statistic has
a sampling distribution and we are simulating it here (but using frequency instead of probability on the
y-axis).
Page 2 of 3
an unbiased estimate of the true value θ, we would need to mathematically prove that
E[ˆθ] − θ = 0 where E[·] is the expectation (i.e., theoretical average)3. Instead, we will
investigate this property empirically by replacing the theoretical average E[ˆθ] with the
sample average of the ˆθ values from our simulation (i.e., Pnsim
i=1ˆθ/nsim where nsim is the
number of simulation runs; θ is N in this case, and ˆθ is either Nˆ
LP or NˆC as both are
ways to estimate N)4.
Estimate the bias of the Lincoln-Peterson and Chapman estimators, based on the results
of your simulation. Is either estimator unbiased when n1, n2 = 100?
6. Based on your findings, is the Lincoln-Peterson or Chapman estimator better? Explain
your answer.
7. Explain why the assumptions (a), (b), and (c) listed on the first page are unrealistic.
3Note that the sample size n does not appear in this equation. For an estimator to be unbiased, this
property cannot depend on sample size.
4Note: This procedure is not a replacement for a mathematical proof, but it’s a good way to explore
statistical properties.

因为专业,所以值得信赖。如有需要,请加QQ:99515681 或邮箱:[email protected]

微信:codehelp

原文地址:https://www.cnblogs.com/wellljava/p/11783506.html

时间: 2024-11-03 17:11:26

SDGB 7844 HW 3: Capture-Recapture Method的相关文章

SDGB 7844

Homework 2: SDGB 7844Submit two files through Blackboard: (a) .Rmd R Markdown file with answers and codeand (b) Word document of knitted R Markdown file. Your file should be named as follows:“HW2-[Full Name]-[Class Time]” and include those details in

【网页加速】lua redis的二次升级

之前发过openresty的相关文章,也是用于加速网页速度的,但是上次没有优化好代码,这次整理了下,优化了nginx的配置和lua的代码,感兴趣的话可以看看上篇的文章: https://www.cnblogs.com/w1570631036/p/8449373.html 为了学习,不断的给自己的服务器装东西,又是logstash,又是kafka,导致主站网络负载.cpu消耗过大,再加上tomcat这个本身就特别占用内存的东西,只要稍微刷新一下网站,就能感受到蜗牛般的速度,实在受不了,前段时间给网

Lua-Nginx-Module常用指令(中)

九.控制响应头 HTTP响应头需要配置很多重要的信息,例如添加CDN缓存时间.操作set-cookie.标记业务数据类型等.利用Lua的API可以轻松完成这些配置,并且它有丰富的模块可供选择. 9.1 获取响应头 ngx.resp.get_headers语法:headers = ngx.resp.get_headers(max_headers?, raw?)配置环境:set_by_lua,rewrite_by_lua,access_by_lua,content_by_lua,headerfilt

HW 3, SDGB 7840: Modeling Literacy Rate

HW 3, SDGB 7840: Modeling Literacy RateDue: 3/28 in classSubmit THREE files through Blackboard: (a) .Rmd R Markdown file with answers andcode, (b) Word document of knitted R Markdown file, and (c) your data file. Your code/Wordfiles should be named a

LoadRunner的Capture Level

场景:录制loadrunner的web站点 问题:录制的过程中发现除了页面正常的请求外还有些看不懂的请求(包含乱码),脚本如下: web_url("WebTours", "URL=http://127.0.0.1:1080/WebTours/", "Resource=0", "RecContentType=text/html", "Referer=", "Snapshot=t14.inf"

Vue.js Method

Method Vue.js 的事件监听一般都通过 v-on 指令配置在HTML中,虽然也可以在Javascript 代码中使用原生 addEventListener 方法添加事件监听,但Vue.js 本身并不提倡如此. 看上去这种方式不符合传统的"关注点分离"的理念,但其实所有的Vue.js 事件处理方法和表达式都严格绑定在当前视图的 ViewModel 上.实际上,采用它提供的 v-on 指令有以下几点好处: (1).通过查看HTML 模板便能轻松定位 Javascript 代码中对

DDoS ATTACK PROCESSING APPARATUS AND METHOD IN OPENFLOW SWITCH

An OpenFlow switch in an OpenFlow environment includes an?attack determination module to collect statistical information on packet processing with respect to incoming packets to be processed in the OpenFlow switch at a predetermined period interval t

Use PrefHUD ES to Do Frame Capture Android Game

Author: http://www.cnblogs.com/open-coder/p/3898224.html This is short tutorial about how to do frame capture with Nvidia PrefHUD. You could find a detail tutorial from here. Before frame capture, some requirement should be fullfilled: 1) OpenGL ES 2

iBus input method in Linux

The following packages should be installed: python-ibus ibus ibus-clutter ibus-gtk ibus-m17n: input many non-latin characters ibus-pinyin ibus-qt4 ibus-table ibus-table-wubi python-xlib: will be used by Emacs ibus.el ibus-m17n: input many non-latin c