Question: Can anyone help with this? Steps ( A ) : Data Import and Exploration This section is worth 0 . 7 5 total points Note:

Can anyone help with this?
Steps (A): Data Import and Exploration
This section is worth 0.75 total points
Note: The plots and tables generated in this section do not need to be included in your WORD document report.
A1. Import the cleaned American Kestrel tracking data set. Coordinates here (x_ and y_) are already projected to the Virginia Lambert coordinate reference system (EPSG: 3968). You can ignore the lat and long columns. Create a spatial object and display the data in tmap with a satellite background to get a sense of the data. (0.25 pts)
A2. Create a summary table of the data with the following information: bird name, start date, end date, tracking duration, and total locations. The data have been resampled and filtered for consecutive bursts, so we are seeing now only the periods where birds were tracked at high resolution. (0.25 pts)
A3. Confirm the collection schedule for this data set by creating an informative plot in ggplot. Various potential plots for this have been demonstrated in the course. Note that birds were tracked only from 8:00 am to 6:00 pm.(0.25 pts)
Steps (B): Hidden Markov Model Fitting
This section is worth 4.5 total points
B1. Create a move object with the kestrel data remembering to arrange the data appropriately, select only the columns you need, and divide coordinates (x_,y_) by 1000 to put into the scale of kilometers. In addition to the core data columns, create 1 new additional column which is the month of each location. Well use this to test if month of the year influencing behavioral states. (0.75 pts)
B2. Fit a 2-state Hidden Markov Model, first testing a null model, then testing a model with month as a covariate. Assume, as we did in the code demo, that state 1 is a foraging state, and state 2 is a longer distance, oriented, traveling state. For context, a kestrel home range diameter is about 600m.(1.0 pts)
B3. Fit a 3-state model with either a null formula, or month covariate depending on which is favored in the 2-state model. (1.0 pts)
B4. Using the best model that was created so far, calculate the predicted state for each tracking location and add this information to your original kestrel dataset. Remember to make sure all data was arranged by date/time.(0.5 pts)
B5. The male kestrel rabbit spent a lot of time in two different locations which were several kilometers apart. In preparation for creating a home range for this kestrel, remove the locations associated with long-distance travel. Create a ggplot map of this birds tracking locations and movement path, coloring points and paths based on state assignment. Create a second plot showing the points only, now with travel points removed. Include these plots in your report, ideally side by side, inserted into your report as a single tiff file. Save the plot into your output/plots folder. (1.25 pts)
Section A already complete:
kestrel_data <- readRDS("/data/processed/data_week3/kestrel9_rs_20min.rds")
library(sf)
kestrel_data_sf <- st_as_sf(kestrel_data, coords = c("x_","y_"), crs =3968)
library(tmap)
tm_shape(kestrel_data_sf)+
tm_bubbles(size =0.1, col = "blue")+
tm_basemap("OpenStreetMap")
library(dplyr)
kestrel_summary <- kestrel_data %>%
group_by(name)%>%
summarize(
start_date = min(t_),
end_date = max(t_),
tracking_duration = as.numeric(difftime(end_date, start_date, units = "days")),
total_locations = n()
)
library(ggplot2)
library(lubridate)
kestrel_data <- kestrel_data %>%
mutate(hour = hour(t_))
ggplot(kestrel_data, aes(x = hour))+
geom_histogram(binwidth =1, fill = "skyblue", color = "black")+
facet_wrap(~name, scales = "free_y")+
labs(
title = "Collection Schedule of American Kestrel Tracking Data",
x = "Hour of Day",
y = "Number of Locations"
)+
scale_x_continuous(breaks = seq(0,23, by =1))+
theme_minimal()
# Q1: Average tracking length and location counts
avg_tracking_duration <- mean(kestrel_summary$tracking_duration)
avg_locations <- mean(kestrel_summary$total_locations)
min_locations <- min(kestrel_summary$total_locations)
max_locations <- max(kestrel_summary$total_locations)
list(
average_tracking_duration_days = avg_tracking_duration,
average_locations_per_bird = avg_locations,
min_locations_per_bird = min_locations,
max_locations_per_bird = max_locations
)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!