-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathteamassign07.R
50 lines (32 loc) · 1.83 KB
/
teamassign07.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
###########################
# #
# Team Assignment 7 #
# #
###########################
# Group 7 | Kennan Grant, Elizabeth Homan, Adrian Mead, Gregory Wert
#################################################################################
## Please submit one set of answers per team. ##
## Your answers should be submitted as a .csv file per the instructions below. ##
## You should also submit your annotated R code per the instructions below. ##
#################################################################################
library(tidyverse)
library(Metrics)
# For this team assignment you will use the file "teamassign07train.csv" to develop
# a linear model using whatever methods you consider appropriate. You will then use
# the model that you have developed to predict the values of the response variable
# corresponding to the explanatory variable values given in the file
# "teamassign07test.csv".
Test <- read.csv("teamassign07test.csv", encoding = 'utf-8', stringsAsFactors = FALSE)
Train <- read.csv("teamassign07train.csv", encoding = 'utf-8', stringsAsFactors = FALSE)
#Separate training set into training and validation components
set.seed(2)
Sample <- sample_n(Train,200)
Valid <- setdiff(Train,Sample)
# Once you have predicted the values of the response variable for the testing set,
# you should save them to a vector called predvect and write them into a .csv file
# using the following code:
write.table(predvect, file="teamassign07preds.csv", row.names=F, col.names=F, sep=",")
# Your annotated R code should explain the reasoning behind your choices in
# model selection and should be neatly organized.
# Your grade on this team assignment will be based on how well your model predicts
# the observed values relative to the other teams.