strum-package: A Package for STRUctural Modeling of Latent Variables for...

Description Details Author(s) References Examples

Description

This package implements the simulation and fitting of a broad range of latent variable and structural equation models. It can handle multilevel models, polygenic random effects and linkage random effects. Traditional structural equation models and confirmatory factor analysis may also be performed. The framework implemented now can only handle quantitative variables. Ordinal and nominal variables will be included in a future release.

Details

Package: strum
Type: Package
Version: 0.6.2
Date: 2015-06-11
License: GPL (>= 2)

The following illustrates the typical steps for a strum analysis.

  1. Construct a strumModel by createStrumModel function.

  2. Prepare data using createStrumData function.

  3. Run analysis by the function call strum.

This package can also be used for simulation studies as following.

  1. Construct a strumSimModel by createSimModel function.

  2. Simulate data using simulateStrumData function.

  3. Run analysis on the simulated data by the function call strum.

Please check "Examples" section for the full illustration of strum use.

Author(s)

Nathan Morris, Yeunjoo Song, Stephen Cahn

Maintainer: Nathan Morris <nathan.morris@cwru.edu>, Yeunjoo Song<yeunjoo.song@cwru.edu>

References

Morris, N.J., Elston, R.C., & Stein, C.M. (2010). A framework for structural equation models in general pedigrees. Human Heredity 70:278-286.

Song, Y.E., Stein, C.M., & Morris, N.J. (2015). strum: an R package for structural modeling of latent variables for general pedigrees. BMC Genetics 16:35.

Examples

  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
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
## Not run: 
#================
# strum analysis
#================

# 1. Construct strumModel
#-------------------------

## 1.1 Model formulas
#---------------------
testForm1 = 'bp     =~ SBP + DBP
             anger  =~ A1 + A2
             stress =~ S1 + S2
             bp ~ anger + stress
             stress ~ anger + rs6040343   
             var(stress)=.1  
            '

testForm2 = 'L1 =~ SBP + DBP
             L1 ~ sex + <a,p,e>
            '

## 1.2 Create a strumModel
#--------------------------
myStrumModel1 = createStrumModel(formulas = testForm1)
myStrumModel2 = createStrumModel(formulas = testForm2)

# 2. Prepare data
#-----------------

## 2.1 Read a data file
#-----------------------
dF = read.table("simped.dat", header=T)

## 2.2 Create a strumData object
#--------------------------------

### 2.2.1 No IBD file
#---------------------
myStrumData1 = createStrumData(dF, "Pedigree")

### 2.2.2 With IBD file
#-----------------------
myStrumData2 = createStrumData(dF, "Pedigree", ibdFileName="GENIBD.chr1.ibd")

# 3. Run strum analysis
#-----------------------

## 3.1 Model with no ibd markers
#--------------------------------
myResult1 = strum(myStrumModel1, myStrumData1)

## 3.2 When an ibd marker is specified
#--------------------------------------
myResult2 = strum(myStrumModel2, myStrumData2, iMarkers=c("chr1marker1"))

#==================
# simulation study
#==================

# 1. Construct simModel
#-----------------------

## 1.1 Get some hapmap data & selct 10 snps
#-------------------------------------------
hap20 = importHapmapData(20) # 'load(file="hap20.rdata")' with saved hapmap data
hap20 = hap20[(1:10)*10,]

## 1.2 Create strumMarker object with hapmap data
#-------------------------------------------------
snpStrumMarker = createStrumMarker(hap20)

## 1.3 Ascertainment function
#-----------------------------
aFunction = function(data) return(any(data$disease == 1))

## 1.4 Model formula
#--------------------
simForm = 'bp     =~ SBP + DBP
           anger  =~ A1 + 0.5*A2
           stress =~ S1 + 0.9*S2
           bp ~ anger + stress + <p,e>
           stress ~ anger + rs6040343   
           var(stress)=.1  
          '

## 1.5 Create a strumModel
#--------------------------
mySimModel = createSimModel(
                 formulas = simForm,
                 markerInfo = snpStrumMarker,
                 ascertainment = aFunction
               )

# 2. Simulate data based on the given data structure 
#----------------------------------------------------

## 2.1 Read a data file
#-----------------------
dF = read.csv("chr1.csv")[,1:8]
names(dF) = c("family","id", "father","mother",names(dF)[5:8])
aStrumData = createStrumData(dF, "Pedigree")

## 2.2 Simulate data
#--------------------
mySimulatedStrumData = simulateStrumData(mySimModel, aStrumData)

# 3. Run strum analysis using simulated data
#--------------------------------------------
mySimResult = strum(myStrumModel1, mySimulatedStrumData)

## End(Not run)

strum documentation built on May 2, 2019, 7:03 a.m.