# fssemR: Solving Sparse Structural Equation Model In fssemR: Fused Sparse Structural Equation Models to Jointly Infer Gene Regulatory Network

 fssemR R Documentation

## Solving Sparse Structural Equation Model

### Description

An optimizer of Fused-Sparse Structural Equation Models, which is the state of the art jointly fused sparse maximum likelihood function for structural equation models proposed by Xin Zhou and Xiaodong Cai (2018 <doi:10.1101/466623>)

### Author(s)

Xin Zhou <xxz220@miami.edu>

### Examples

```seed = as.numeric(Sys.time())
N = 100                                           # sample size
Ng = 5                                            # gene number
Nk = 5 * 3                                        # eQTL number
Ns = 1                                            # sparse ratio
sigma2 = 0.01                                     # sigma2
set.seed(seed)
library(fssemR)
data = randomFSSEMdata(n = N, p = Ng, k = Nk, sparse = Ns, df = 0.3, sigma2 = sigma2,
u = 5, type = "DG", nhub = 1, dag = TRUE)
gamma = cv.multiRegression(data\$Data\$X, data\$Data\$Y, data\$Data\$Sk, ngamma = 20, nfold = 5,
N, Ng, Nk)
fit   = multiRegression(data\$Data\$X, data\$Data\$Y, data\$Data\$Sk, gamma, N, Ng, Nk,
trans = FALSE)
Xs    = data\$Data\$X
Ys    = data\$Data\$Y
Sk    = data\$Data\$Sk

## cross-validation
## cvfitc <- cv.multiFSSEMiPALM(Xs = Xs, Ys = Ys, Bs = fit\$Bs, Fs = fit\$Fs, Sk = Sk,
##                              sigma2 = fit\$sigma2, nlambda = 10, nrho = 10,
##                              nfold = 5, p = Ng, q = Nk, wt = TRUE)

fitm <- opt.multiFSSEMiPALM(Xs = Xs, Ys = Ys, Bs = fit\$Bs, Fs = fit\$Fs, Sk = Sk,
sigma2 = fit\$sigma2, nlambda = 10, nrho = 10,
p = Ng, q = Nk, wt = TRUE)

fitc0 <- fitm\$fit

(TPR(fitc0\$Bs[], data\$Vars\$B[]) + TPR(fitc0\$Bs[], data\$Vars\$B[])) / 2
(FDR(fitc0\$Bs[], data\$Vars\$B[]) + FDR(fitc0\$Bs[], data\$Vars\$B[])) / 2
TPR(fitc0\$Bs[] - fitc0\$Bs[], data\$Vars\$B[] - data\$Vars\$B[])
FDR(fitc0\$Bs[] - fitc0\$Bs[], data\$Vars\$B[] - data\$Vars\$B[])
```

fssemR documentation built on March 18, 2022, 7:24 p.m.