-
Notifications
You must be signed in to change notification settings - Fork 0
/
LinReg.r
52 lines (49 loc) · 1.5 KB
/
LinReg.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
library(R6)
# LinReg class
LinReg <- R6Class(
"LinReg",
public = list(
distribution = NULL,
regression_type = NULL,
backbone = NULL,
initialize = function(regression_type, distribution) {
self$regression_type <- regression_type
self$distribution <- distribution
self$get_backbone_package()
},
# Get suggested underlying package
get_backbone_package = function() {
if (self$regression_type == "glmm"){
self$backbone <- "glmer"
} else if (self$regression_type == "lmm"){
self$backbone <- "lmer"
} else if (self$regression_type == "glm"){
self$backbone <- "glmer"
} else if (self$regression_type == "lm"){
self$backbone <- "lmer"
}
},
print = function() {
cat("LinReg: \n")
cat("Regression Type: ", self$regression_type, "\n")
cat("Data Distribution: ", self$distribution, "\n")
cat("Backbone: ", self$backbone, "\n")
},
emmeans = function() {},
check_normality = function() {},
get_R2 = function() {},
omnibus_tests = function() {},
post_hoc_ttests = function() {},
model_performance_plots = function() {},
model_AIC_test = function () {},
model_comparisons = function () {},
missing_data = function () {},
pipeline = function() {},
plot_regression() {},
effect_sizes = function() {}
)
)
# Add a similar class but for ANOVA
# Create an instance of the Person class
p <- LinReg$new("lmm", "normal")
p$print()