当前位置:天才代写 > R语言代写,r语言代做-无限次修改 > 统计R代码代写 RMarkdown代写 STA代写

统计R代码代写 RMarkdown代写 STA代写

2021-11-16 15:18 星期二 所属: R语言代写,r语言代做-无限次修改 浏览:452

STA365 Assignment 2

统计R代码代写 Modelling animal movement:A key task in ecology is understanding how environmental conditions affffect animal behaviour.

Assignment instructions and marking information

The assignment should be produced using RMarkdown, R, and Stan.

  • Each task is worth 10%
  • All code for performing each task must be present. If there is no code you will lose most marks.
  • Each task requires some reflflective writing. Make sure you write things! In particular, there is no single solution to this task, so the justifification and interpretation of the steps is important! Two otherwise identical solutions with difffferent justififications and interpretations could receive very difffferent marks.
  • Each task requires the production of several plots and fifigures. These plots should be cleanly laid out with adequate captions, markings, labels, and legends.

This is an assignment that uses real data. As such, you should be prepared for the model to possibly be a poor fifit for the data and you should discuss this if it occurs.

 

Modelling animal movement  统计R代码代写

A key task in ecology is understanding how environmental conditions affffect animal behaviour. In this assignment we will look at how environmental factors change how raptors move.

Raptors are large birds that cover a lot of ground by gliding. This requires some specifific environmental conditions, so it’s plausible to imagine that a raptor would have two types of movement state:

  • A low energy state, where the bird is preening or resting and not moving around a lot; and
  • A high engery state, where the bird is moving around a lot.

There is no way to know whether or not a raptor is in a high or low energy state at any given period of time.

An appropriate measure of movement is the minimum specifific acceleration (MSA), which is given for a single raptor in the attached data. The correct scale to consider MSA on is the log-scale.

 

The data  统计R代码代写

The data can be read in as

dat <- read.csv("Verreauxs.accel.txt", sep = "\t")
head(dat)

##            date_time msa     wind_speed saws_temp hrseg
## 1 2013-04-16 13:03:44 0.23787533   3.6   16.5   1
## 2 2013-04-16 13:05:38 0.09222497   3.6   16.5   1
## 3 2013-04-16 13:07:27 0.27394695   3.6   16.5   1
## 4 2013-04-16 13:37:51 0.28776082   3.6   16.5   5
## 5 2013-04-16 13:39:44 0.59848213   3.6   16.5   5
## 6 2013-04-16 13:41:36 0.12466199   3.6   16.5   5

There are severaral variables in the data but the relevant variables are:

  • MSA: our observation
  • wind_speed: The wind speed (m/s)
  • saws_temp: Temperature (celsius)

 

统计R代码代写
统计R代码代写

 

Task 1: Fitting a simple model to simulated data

Simulate data from a mixture of two normal distributions with pi = p (a constant, but unknown, parameter) and write a Stan model to fifit the data.

  • You can use any experimental set up you want, but you should justify your choices in writing.
  • You should do some basic prior predictive checks.
  • You should do some posterior predictive checks and comment on how the model fifit, including any problems you had with the sampler.

 

Task 2: Fitting the data 

Fit two difffferent 2 component mixture model to the given data. The fifirst model should have a fifixed p, while the second model should have the probability of being in state 2 as

logit(pi) = β0 + β1wind + β2temp.

  • Write Stan code to fifit these model
  • Use posterior predictive checks to comment on how well both models fifit.
  • Use leave-one-out crossvalidation to select the best model and interpret the choice.

 

Task 3: Spurious components  统计R代码代写

Imagine that we are uncertain if there are 2 or 3 difffferent energetic states. In this case, one option would be to fifit a 3 component model with a prior that puts a lot of mass on 1 and 2 component models.

Design a prior for a 3 component model that has support on lower-dimensional models. (You might want to think about how we built the horseshoe prior). Explain and justify why this prior should work.

Fit the model to two simulated data sets:

  • One where the data is simulated from a model with 2 components
  • One where the data is simulated from a model with 3 component

Comment on how the model fifits in both scenarios. Are there computational problems? Is the spurious component ignored?

 

统计R代码代写
统计R代码代写

 

 

更多代写:版图assignment代写 北美C++代考 英国论文写作案例 澳洲留学Essay代写 北美argumentative essay代写 项目管理专业代写

合作平台:随笔代写 论文代写 写手招聘 英国留学生代写

 

 

天才代写-代写联系方式