This repository has been archived by the owner on Jan 3, 2024. It is now read-only.
forked from cuamc-dop-ids/hptbi-hackathon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfss_model.R
54 lines (45 loc) · 1.73 KB
/
fss_model.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
49
50
51
52
53
54
################################################################################
#
################################################################################
# FSS Model
#
# Args:
# data a data.frame resulting from a call to prepare_fss_data()
#
# Return:
# An R object. This object will have the "hackathon_fss_model" class
# prepended to it such that a call to predict can be used to generate
# predictions from the training and testing data sets.
#
fss_model <- function(data) {
##############################################################################
# User code starts here
rtn <- lm(fss_total ~ age + female + icpyn1, data = data)
# User code ends here
##############################################################################
class(rtn) <- c("hackathon_fss_model", class(rtn))
rtn
}
################################################################################
# Predict Hackathon Mortality Model
#
# An S3 function call for hackathon_fss_model
#
# Args:
# object a hackathon_fss_model object
# newdata a data.frame
# ... additional arguments passed through. Not expected to be used as
# part of the hackathon.
#
# Return:
# A numeric vector of length equal to the nrow(newdata) representing the
# predicted total FSS score.
#
predict.hackathon_fss_model <- function(object, newdata, ...) {
##############################################################################
# user defined code starts here
as.integer(stats::predict.lm(object, newdata, type = "response", ...))
}
################################################################################
# End of File
################################################################################