代写ECON 3E03、代做R设计编程
Assignment 1
ECON 3E03 – Fall 2024
Due: Sunday, September 29, 11:59pm
Total Marks: 20
Worth: 10% of your final grade
Assignment Description
This assignment provides an introduction to the R software package. This assignment is based on Units 1 and 2 in the course. Using the course datasets, you will be required to answer a series of questions.
Some of the R commands needed to complete the assignment are found throughout the weekly lecture and tutorial notes. You may need to do your own research to find additional codes to complete certain questions. The use of AI (e.g., ChatGPT) to assist in coding is permitted; however, please note the following:
1) Any code which you obtain from an AI source must be clearly indicated in your answer documents.
2) The AI does not always write accurate codes...
This assignment may be completed individually or in groups of up to four students.
To access the assignment submission dropbox,
a group are responsible for forming and managing their own groups. Do not assign yourself to a
group with other students unless they have already agreed to work with you.
The assignment is to be submitted via Avenue. Emailed assignments cannot be accepted.
The name(s) of the student(s) preparing the assignment must appear clearly on the title page of the assignment. Any “group member” whose name does not appear on the title page will not receive a grade for the submission. Failure to include a title page will result in a grade deduction.
© Dr. Colin Mang, 2024
page, even if you are submitting the assignment individually
you must join a group on the Avenue Groups
. Students who choose to work in
Assignment Instructions
On Avenue, you will find the following data files listed in the Data Files content folder:
spending.RData LFSJune24.RData
These data files will be used for the assignment.
On Avenue, you will find the following R Script file listed in the Assignments content folder: Assignment R Script.R
Perform the following tasks in order:
1) Select you group members to work with.
2) All students must enroll in a group on Avenue, even if you are completing the assignment on your own. If you are working on your own, join an empty group where you will be the only member. If you are working with other students then each member of the group must self-enroll in the group on Avenue. After the first member enrolls, make note of the group number so that other members can self-enroll in the same group. If you accidently join the wrong group by mistake, please email your professor to correct it. Do not join a group without talking to the other group members first!
3) If you are working on your own, skip this step. If you are working with other students, choose a Group Leader. The Group Leader will be responsible for ensuring the project is submitted and for other aspects as described below.
4) Download the two datasets and the Assignment R Script.R file.
5) Rename the Assignment R Script.R file to StudentNumber.R where StudentNumber is the Group Leader’s student number (i.e., 12345678.R).
6) Open the R Script file. The R Script file has the following structure:
#Assignment R Script #
#ECON3E03 Fall 2024
#Part 1 - spending.RData
set.seed(xx) # Replace xx with group leader student number
SpendingSample <- spending[-sample(1:nrow(spending), 653), ] # Generates a unique 80% sample that is different from any other group
# Use the new datafile SpendingSample for the Part 1 Questions
### Enter Codes for Each Question below this line. If you have used an AI program to write any codes, you must indicate the use of AI by including " # This code generated by AI " after the code
### End of Part 1
#Part 2 - LFSJune2024.RData
set.seed(xx) # Replace xx with group leader student number
LFSSample <- LFSJune2024[-sample(1:nrow(LFSJune2024), 4043), ] # Generates a unique 80% sample that is different from any other group
# Use the new datafile LFSSample for the Part 2 Questions
### Enter Codes for Each Question below this line. If you have used an AI program to write any codes, you must indicate the use of AI by including " # This code generated by AI " after the code
### End of Part 2
7) On Line 1, indicate that this code is for Assignment 1. On Line 2 write the names of all group members.
8) On Lines 7 and 22, replace xx with the group leader’s student number.
[Insert Assignment Number]
[Insert Name(s)]
9) Determine the appropriate code to conduct the tests required for Part 1. Type the code into the space between the lines:
### Enter Codes for Each Question below this line.
[Enter your codes here]
### End of Part 1
10) Determine the appropriate codes to conduct the tests required for Part 2. Type the code into the space between the lines:
### Enter Codes for Each Question below this line.
[Enter your codes here]
### End of Part 1
11) If you have used an AI tool (e.g., ChatGPT) to write any of the codes, you must include the
line:
# This code generated by AI
12) Run your R Script.
13) Prepare a written report answering each of the questions below. Copy and paste the analysis output from R where appropriate.
14) Save your report in MS Word (.docx) or PDF (.pdf) format with the file name StudentNumber.docx or StudentNumber.pdf where StudentNumber is the student number of the group leader. Ensure that the report contains a title page that lists the full names and student numbers of all group members and clearly identifies which group member is the group leader for this assignment. Failure to include a title page will result in a grade deduction.
15) Upload the report StudentNumber.docx/StudentNumber.pdf AND the R Script file StudentNumber.R to the assignment dropbox on Avenue.
Note that the set seed and sample commands will take a random 80% subsample of the data that is different for every group. For this reason, the numbers that you get with your output will not be the same for any two groups. Be mindful of this fact if you are comparing your work with other groups. If you want to play around with the data to test out commands before running your R Script, be sure to apply the set seed and sample commands only once before doing so.
after each code in your R script that was written by an AI. You must also include the statement in
your answer document for each question where you used an AI.
Assignment Questions
The following are the assignment questions. When answering each question, be sure to include the relevant R output as well as any written explanation required in your answer document.
Part 1 [10 Marks]
Part 1 uses the spending.RData dataset
1) [2 Marks] Conduct a hypothesis test of the following: Can we conclude with 95% confidence that persons who rent their home are less likely than homeowners to have a computer?
2) [2 Marks] Conduct a hypothesis test of the following: Can we conclude with 95% confidence that persons who rent their home are less likely than homeowners to have a vehicle?
3) [3 Marks] Create a scatter plot with age on the X-axis and total expenditure on the Y-axis. What is the correlation coefficient between age and total expenditure?
4) [3 Marks] Examine the variable SH002. Do persons who own their home and have a mortgage spend more on their principal accommodation than persons who rent?
Part 2 [10 Marks]
Part 2 uses the LFSJune24.RData dataset
5) [2 Marks] Create a scatter plot with job tenure on the X-axis and hourly earnings on the Y- axis. What is the correlation between job tenure and hourly earnings?
6) [2 Marks] Conduct a hypothesis test of the following: Do persons with a permanent job earn more per hour than persons who do not have a permanent job?
7) [3 Marks] Conduct a hypothesis test of the following: Do persons who are unionized earn more per hour than persons who are not unionized?
8) [3 Marks] Conduct a hypothesis test of the following: Do unionized workers in the public sector earn more per hour than unionized workers in the private sector?
A note on plagiarism: this is an independent assignment, which you are expected to complete within your own group. It is plagiarism to copy someone else’s work verbatim, which includes R Script files. Any work you submit should be the product of your group only.