@@ -34,7 +34,9 @@ classical_lsq<-setClass(
34
34
# OUTPUTS
35
35
outputs.coefficients = ' entity' ,
36
36
outputs.p_value = ' entity.stato' ,
37
- outputs.significant = ' entity'
37
+ outputs.significant = ' entity' ,
38
+ outputs.r_squared = ' entity' ,
39
+ outputs.adj_r_squared = ' entity'
38
40
),
39
41
prototype = list (name = ' Univariate Classical Least Squares Regression' ,
40
42
description = ' classical least squares, where y is the response and x is the design matrix, applied to each feature individually.' ,
@@ -76,6 +78,14 @@ classical_lsq<-setClass(
76
78
outputs.significant = entity(name = ' Significant features' ,
77
79
type = ' data.frame' ,
78
80
description = ' TRUE if the calculated p-value is less than the supplied threhold (alpha)'
81
+ ),
82
+ outputs.r_squared = entity(name = ' R Squared' ,
83
+ description = ' The value of R Squared for the fitted model.' ,
84
+ type = ' data.frame'
85
+ ),
86
+ outputs.adj_r_squared = entity(name = ' Adjusted R Squared' ,
87
+ description = ' The value ofAdjusted R Squared for the fitted model.' ,
88
+ type = ' data.frame'
79
89
)
80
90
)
81
91
)
@@ -149,6 +159,12 @@ setMethod(f="method.apply",
149
159
150
160
M $ p_value = df2
151
161
162
+ df3 = data.frame (' r_squared' = unlist(lapply(out ,function (x ){return (x $ r.squared )})))
163
+ df4 = data.frame (' adj_r_squared' = unlist(lapply(out ,function (x ){return (x $ adj.r.squared )})))
164
+ rownames(df3 )= rownames(df )
165
+ rownames(df4 )= rownames(df )
166
+ M $ r_squared = df3
167
+ M $ adj_r_squared = df4
152
168
153
169
# fdr correct the p-values
154
170
M $ p_value = as.data.frame(apply(M $ p_value ,2 ,FUN = function (x ) {p.adjust(x ,M $ mtc )}))
0 commit comments