fastglmm
Massively scalable generalized linear mixed models
Toggle main menu visibility
Loading...
Searching...
No Matches
inst
include
exportToR_fastlmm.h
Go to the documentation of this file.
1
2
/***************************************************************
3
* @file exportToR_fastlmm.h
4
* @author Gabriel Hoffman
5
* @email gabriel.hoffman@mssm.edu
6
* @brief Export results to R as List
7
* Copyright (C) 2024 Gabriel Hoffman
8
**************************************************************/
9
10
#ifndef _EXPORT_TO_R_FASTLMM_
11
#define _EXPORT_TO_R_FASTLMM_
12
13
#ifdef USE_R
14
15
using namespace
Rcpp;
16
using namespace
fastglmmLib
;
17
18
// Depends on Rcpp::List, so define outside of class
19
const
List toList(
ModelFitLMM
&res){
20
21
List lst = List::create(
22
Named(
"logLik"
) = res.
logLik
,
23
Named(
"coefficients"
) = res.
coef
,
24
Named(
"se"
) = res.
se
,
25
Named(
"vcov"
) = res.
vcov
,
26
Named(
"weights"
) = res.
weights
,
27
Named(
"delta"
) = res.
delta
,
28
Named(
"sigSq_g"
) = res.
sigSq_g
,
29
Named(
"sigSq_e"
) = res.
sigSq_e
,
30
Named(
"dispersion"
) = res.
dispersion
,
31
Named(
"ru"
) = res.
ru
,
32
Named(
"y"
) = res.
y
,
33
Named(
"iter"
) = res.
iter
,
34
Named(
"w.mean"
) = res.
w_mean
,
35
Named(
"s"
) = res.
s
,
36
Named(
"hessian.vc"
) = res.
hessian_vc
,
37
Named(
"A.sat"
) = res.
A_sat
,
38
Named(
"B.sat"
) = res.
B_sat
);
39
40
// Set U as either full or sparse matrix
41
if
( res.
isSet_U
) lst[
"U"
] = res.
U
;
42
if
( res.
isSet_Usp
) lst[
"U"
] = res.
Usp
;
43
44
// Set V as either full or sparse matrix
45
if
( res.
isSet_V
) lst[
"V"
] = res.
V
;
46
if
( res.
isSet_Vsp
) lst[
"V"
] = res.
Vsp
;
47
48
return
lst;
49
}
50
51
template
<
typename
T1,
typename
T2,
typename
T3>
52
const
List toList(
fastlmm<T1, T2, T3>
& fit){
53
54
ModelFitLMM
res = fit.
get_result
(
true
);
55
56
return
toList( res );
57
}
58
59
List toList(
const
vector<ModelFitLMM> &resList){
60
List L = List::create();
61
62
for
(
int
i=0; i<resList.size(); i++){
63
ModelFitLMM
res = resList.at(i);
64
L.push_back( toList( res ) );
65
}
66
return
L;
67
}
68
69
70
71
// Depends on Rcpp::List, so define outside of class
72
const
List toList(
ModelFitGLMM
&res){
73
74
List lst = List::create(
75
Named(
"logLik"
) = res.
logLik
,
76
Named(
"coefficients"
) = res.
coef
,
77
Named(
"se"
) = res.
se
,
78
Named(
"vcov"
) = res.
vcov
,
79
Named(
"weights"
) = res.
weights
,
80
Named(
"delta"
) = res.
delta
,
81
Named(
"sigSq_g"
) = res.
sigSq_g
,
82
Named(
"sigSq_e"
) = res.
sigSq_e
,
83
Named(
"dispersion"
) = res.
dispersion
,
84
Named(
"ru"
) = res.
ru
,
85
Named(
"y"
) = res.
y
,
86
Named(
"family"
) = res.
family
,
87
Named(
"iter"
) = res.
iter
,
88
Named(
"w.mean"
) = res.
w_mean
,
89
Named(
"s"
) = res.
s
,
90
Named(
"hessian.vc"
) = res.
hessian_vc
,
91
Named(
"A.sat"
) = res.
A_sat
,
92
Named(
"B.sat"
) = res.
B_sat
);
93
94
// Set U as either full or sparse matrix
95
if
( res.
isSet_U
) lst[
"U"
] = res.
U
;
96
if
( res.
isSet_Usp
) lst[
"U"
] = res.
Usp
;
97
98
// Set V as either full or sparse matrix
99
if
( res.
isSet_V
) lst[
"V"
] = res.
V
;
100
if
( res.
isSet_Vsp
) lst[
"V"
] = res.
Vsp
;
101
102
return
lst;
103
}
104
105
template
<
typename
T1,
typename
T2,
typename
T3>
106
const
List toList(
fastglmm<T1, T2, T3>
& fit){
107
108
ModelFitGLMM
res = fit.
get_result
();
109
110
return
toList( res );
111
}
112
113
#endif
114
#endif
fastglmmLib::ModelFitGLMM
Definition
ModelFit.h:355
fastglmmLib::ModelFitGLMM::family
string family
Definition
ModelFit.h:385
fastglmmLib::ModelFit::coef
vec coef
Definition
ModelFit.h:40
fastglmmLib::ModelFit::vcov
mat vcov
Definition
ModelFit.h:45
fastglmmLib::ModelFit::se
vec se
Definition
ModelFit.h:41
fastglmmLib::ModelFit::dispersion
double dispersion
Definition
ModelFit.h:42
fastglmmLib::ModelFitLMM
Definition
ModelFit.h:201
fastglmmLib::ModelFitLMM::w_mean
double w_mean
Definition
ModelFit.h:208
fastglmmLib::ModelFitLMM::logLik
double logLik
Definition
ModelFit.h:204
fastglmmLib::ModelFitLMM::ru
vec ru
Definition
ModelFit.h:205
fastglmmLib::ModelFitLMM::Vsp
sp_mat Vsp
Definition
ModelFit.h:215
fastglmmLib::ModelFitLMM::sigSq_g
double sigSq_g
Definition
ModelFit.h:206
fastglmmLib::ModelFitLMM::A_sat
mat A_sat
Definition
ModelFit.h:219
fastglmmLib::ModelFitLMM::hessian_vc
mat hessian_vc
Definition
ModelFit.h:219
fastglmmLib::ModelFitLMM::s
vec s
Definition
ModelFit.h:216
fastglmmLib::ModelFitLMM::V
mat V
Definition
ModelFit.h:214
fastglmmLib::ModelFitLMM::y
vec y
Definition
ModelFit.h:205
fastglmmLib::ModelFitLMM::U
mat U
Definition
ModelFit.h:214
fastglmmLib::ModelFitLMM::isSet_U
bool isSet_U
Definition
ModelFit.h:210
fastglmmLib::ModelFitLMM::isSet_Vsp
bool isSet_Vsp
Definition
ModelFit.h:213
fastglmmLib::ModelFitLMM::sigSq_e
double sigSq_e
Definition
ModelFit.h:206
fastglmmLib::ModelFitLMM::B_sat
mat B_sat
Definition
ModelFit.h:219
fastglmmLib::ModelFitLMM::delta
double delta
Definition
ModelFit.h:206
fastglmmLib::ModelFitLMM::Usp
sp_mat Usp
Definition
ModelFit.h:215
fastglmmLib::ModelFitLMM::weights
vec weights
Definition
ModelFit.h:205
fastglmmLib::ModelFitLMM::isSet_V
bool isSet_V
Definition
ModelFit.h:212
fastglmmLib::ModelFitLMM::iter
int iter
Definition
ModelFit.h:207
fastglmmLib::ModelFitLMM::isSet_Usp
bool isSet_Usp
Definition
ModelFit.h:211
fastglmmLib::fastglmm
Definition
fastglmm_fit.h:37
fastglmmLib::fastglmm::get_result
ModelFitGLMM get_result()
Definition
fastglmm_fit.h:296
fastglmmLib::fastlmm
Definition
fastlmm_fit.h:35
fastglmmLib::fastlmm::get_result
ModelFitLMM get_result(const bool &returnUS=false)
Definition
fastlmm_fit.h:531
fastglmmLib
Definition
CleanData.h:17
Generated by
1.17.0