snp.lhs.estimates: Logistic regression with SNP genotypes as dependent variable

Description Usage Arguments Details Value Note Author(s) See Also Examples

View source: R/glm-test.R

Description

Under the assumption of Hardy-Weinberg equilibrium, a SNP genotype is a binomial variate with two trials for an autosomal SNP or with one or two trials (depending on sex) for a SNP on the X chromosome. With each SNP in an input "SnpMatrix" as dependent variable, this function fits a logistic regression model. The Hardy-Weinberg assumption can be relaxed by use of a "robust" option.

Usage

1
2
3
snp.lhs.estimates(snp.data, base.formula, add.formula, subset, snp.subset,
                data = sys.parent(), robust = FALSE, uncertain = FALSE,
                control=glm.test.control())

Arguments

snp.data

The SNP data, as an object of class "SnpMatrix" or "XSnpMatrix"

base.formula

A formula object describing a base model containing those terms which are to be fitted but for which parameter estimates are not required (the dependent variable is omitted from the model formula)

add.formula

A formula object describing the additional terms in the model for which parameter estimates are required (again, the dependent variable is omitted)

subset

An array describing the subset of observations to be considered

snp.subset

An array describing the subset of SNPs to be considered. Default action is to test all SNPs.

data

The data frame in which base.formula, add.formula and subset are to be evaluated

robust

If TRUE, Hardy-Weinberg equilibrium will is not assumed in calculating the variance-covariance matrix of parameter estimates

uncertain

If TRUE, uncertain genotypes are used and scored by their posterior expectations. Otherwise they are treated as missing. If set, this option forces robust variance estimates

control

An object giving parameters for the IRLS algorithm fitting of the base model and for the acceptable aliasing amongst new terms to be tested. See glm.test.control

Details

The model fitted is the union of the base.formula and add.formula models, although parameter estimates (and their variance-covariance matrix) are only generated for the parameters of the latter. The "robust" option causes a Huber-White "sandwich" estimate of the variance-covariance matrix to be used in place of the usual inverse second derivative matrix of the log-likelihood (which assumes Hardy-Weinberg equilibrium). If a data argument is supplied, the snp.data and data objects are aligned by rowname. Otherwise all variables in the model formulae are assumed to be stored in the same order as the columns of the snp.data object.

Value

An object of class GlmEstimates

Note

A factor (or several factors) may be included as arguments to the function strata(...) in the base.formula. This fits all interactions of the factors so included, but leads to faster computation than fitting these in the normal way. Additionally, a cluster(...) call may be included in the base model formula. This identifies clusters of potentially correlated observations (e.g. for members of the same family); in this case, an appropriate robust estimate of the variance-covariance matrix of parameter estimates is calculated. No more than one strata() call may be used, and neither strata(...) or cluster(...) calls may appear in the add.formula.

If uncertain genotypes (e.g. as a result of imputation) are used, the interpretation of the regression coefficients is questionable.

A known bug is that the function fails when no data argument is supplied and the base model formula contains no variables (~1). A work-round is to create a data frame to hold the variables in the models and pass this as data=.

Author(s)

David Clayton dc208@cam.ac.uk

See Also

GlmEstimates-class, snp.lhs.tests

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
data(testdata)
test1 <-
snp.lhs.estimates(Autosomes[,1:10], ~cc, ~region, data=subject.data)
test2 <-
snp.lhs.estimates(Autosomes[,1:10], ~strata(region), ~cc,
   data=subject.data)
test3 <-
snp.lhs.estimates(Autosomes[,1:10], ~cc, ~region, data=subject.data, robust=TRUE)
test4 <-
snp.lhs.estimates(Autosomes[,1:10], ~strata(region), ~cc,
   data=subject.data, robust=TRUE)
test5 <- snp.lhs.estimates(Autosomes[,1:10], ~region+sex, ~cc, data=subject.data, robust=TRUE)
print(test1)
print(test2)
print(test3)
print(test4)
print(test5)

Example output

Loading required package: survival
Loading required package: Matrix
Warning message:
In snp.lhs.estimates(Autosomes[, 1:10], ~cc, ~region, data = subject.data) :
  Monomorphic SNP: 6
There were 13 warnings (use warnings() to see them)
Warning message:
In snp.lhs.estimates(Autosomes[, 1:10], ~cc, ~region, data = subject.data,  :
  Monomorphic SNP: 6
There were 13 warnings (use warnings() to see them)
Warning messages:
1: In snp.lhs.estimates(Autosomes[, 1:10], ~region + sex, ~cc, data = subject.data,  :
  Variable(s) in the base model were aliased and have been dropped
2: In snp.lhs.estimates(Autosomes[, 1:10], ~region + sex, ~cc, data = subject.data,  :
  Monomorphic SNP: 6
3: In snp.lhs.estimates(Autosomes[, 1:10], ~region + sex, ~cc, data = subject.data,  :
  Failure to converge while fitting model for SNP 7
4: In snp.lhs.estimates(Autosomes[, 1:10], ~region + sex, ~cc, data = subject.data,  :
  No estimable parameters for test 7

 Model  Y-variable             Parameter    Estimate        S.E.     z-value
----------------------------------------------------------------------------
173760      173760   regionE & W Ridings     0.39201      7274.9       0.000
                    regionNorth Midlands     0.26996      6752.7       0.000
                           regionEastern     0.40499      6467.9       0.000
                        regionSouth-East    -0.55677      9853.1      -0.000
                          regionSouthern     0.10589      8060.8       0.000
                        regionSouth-West     0.32633      6696.7       0.000
                          regionMidlands     0.50665      6824.2       0.000
                            regionLondon     0.11718      7453.4       0.000
                        regionNorth-West      16.621      6289.6       0.003
----------------------------------------------------------------------------
173761      173761   regionE & W Ridings    -0.63382     0.60277      -1.052
                    regionNorth Midlands    -0.69774      0.5563      -1.254
                           regionEastern     -1.0848       0.534      -2.032
                        regionSouth-East     -1.0587     0.76127      -1.391
                          regionSouthern      -1.031     0.66732      -1.545
                        regionSouth-West    -0.75518      0.5518      -1.369
                          regionMidlands     -1.3374     0.57142      -2.340
                            regionLondon     -1.1751     0.61997      -1.895
                        regionNorth-West     -1.1277     0.54836      -2.057
----------------------------------------------------------------------------
173762      173762   regionE & W Ridings    -0.63809     0.60296      -1.058
                    regionNorth Midlands    -0.74302     0.55662      -1.335
                           regionEastern     -1.0894     0.53417      -2.039
                        regionSouth-East     -1.0531     0.76141      -1.383
                          regionSouthern     -1.0327     0.66751      -1.547
                        regionSouth-West    -0.72386     0.55241      -1.310
                          regionMidlands     -1.3689      0.5735      -2.387
                            regionLondon      -1.177     0.62014      -1.898
                        regionNorth-West     -1.1317     0.54854      -2.063
----------------------------------------------------------------------------
173767      173767   regionE & W Ridings     0.20983     0.60937       0.344
                    regionNorth Midlands     0.06599     0.54673       0.121
                           regionEastern    -0.14769     0.52102      -0.283
                        regionSouth-East     0.82081     0.83625       0.982
                          regionSouthern    -0.62109     0.66515      -0.934
                        regionSouth-West    -0.03987     0.54178      -0.074
                          regionMidlands    -0.32735     0.55513      -0.590
                            regionLondon    -0.78515     0.60617      -1.295
                        regionNorth-West     0.27804     0.53877       0.516
----------------------------------------------------------------------------
173769      173769   regionE & W Ridings      4.5881      7.5594       0.607
                    regionNorth Midlands    -0.34476      1.0102      -0.341
                           regionEastern    -0.91347     0.78971      -1.157
                        regionSouth-East     -1.3439      1.2662      -1.061
                          regionSouthern      4.6814      10.011       0.468
                        regionSouth-West    -0.60396     0.92292      -0.654
                          regionMidlands      4.5527      5.5668       0.818
                            regionLondon      4.6776      7.9665       0.587
----------------------------------------------------------------------------
    173770 - No estimates available
----------------------------------------------------------------------------
173772      173772   regionE & W Ridings     0.51442      4684.7       0.000
                    regionNorth Midlands     -15.513      3882.2      -0.004
                           regionEastern     0.51587      4029.5       0.000
                        regionSouth-East    -0.47471      6572.8      -0.000
                          regionSouthern     0.13355      5040.4       0.000
                        regionSouth-West     0.45914      4198.5       0.000
                          regionMidlands     0.71392      4368.7       0.000
                            regionLondon     0.14812      4650.3       0.000
                        regionNorth-West     0.42546      4143.4       0.000
----------------------------------------------------------------------------
173774      173774   regionE & W Ridings    -0.58188     0.85382      -0.681
                    regionNorth Midlands     0.13666     0.82751       0.165
                           regionEastern    -0.31416     0.77684      -0.404
                        regionSouth-East      13.126      322.33       0.041
                          regionSouthern  -0.0071896     0.97631      -0.007
                        regionSouth-West     0.08923     0.81648       0.109
                          regionMidlands    -0.14467     0.82405      -0.176
                            regionLondon    -0.13347     0.89696      -0.149
                        regionNorth-West    -0.35987     0.79362      -0.453
----------------------------------------------------------------------------
173775      173775   regionE & W Ridings    -0.66611     0.72745      -0.916
                    regionNorth Midlands    -0.15507     0.62869      -0.247
                           regionEastern    -0.37129     0.60146      -0.617
                        regionSouth-East      -13.82      275.34      -0.050
                          regionSouthern     -1.2929     0.93791      -1.378
                        regionSouth-West    -0.57642     0.63565      -0.907
                          regionMidlands    -0.50419     0.65354      -0.771
                            regionLondon     -1.0341     0.78327      -1.320
                        regionNorth-West    -0.33239     0.61948      -0.537
----------------------------------------------------------------------------
173776      173776   regionE & W Ridings     0.17345     0.61225       0.283
                    regionNorth Midlands     0.27629     0.45841       0.603
                           regionEastern     0.23642     0.37815       0.625
                        regionSouth-East     -3.9329      3.9715      -0.990
                          regionSouthern      0.4868     0.69274       0.703
                        regionSouth-West     0.65519     0.41428       1.582
                          regionMidlands    0.076408     0.50534       0.151
                            regionLondon    -0.45808     0.79158      -0.579
----------------------------------------------------------------------------

 Model  Y-variable  Parameter    Estimate        S.E.     z-value
-----------------------------------------------------------------
    173760 - No estimates available
-----------------------------------------------------------------
173761      173761     cccase     0.17833     0.14735       1.210
-----------------------------------------------------------------
173762      173762     cccase     0.20456      0.1479       1.383
-----------------------------------------------------------------
173767      173767     cccase    -0.12877     0.14882      -0.865
-----------------------------------------------------------------
    173769 - No estimates available
-----------------------------------------------------------------
    173770 - No estimates available
-----------------------------------------------------------------
    173772 - No estimates available
-----------------------------------------------------------------
    173774 - No estimates available
-----------------------------------------------------------------
    173775 - No estimates available
-----------------------------------------------------------------
    173776 - No estimates available
-----------------------------------------------------------------

 Model  Y-variable             Parameter    Estimate        S.E.     z-value
----------------------------------------------------------------------------
173760      173760   regionE & W Ridings     0.39201      1.0066       0.389
                    regionNorth Midlands     0.26996      1.0026       0.269
                           regionEastern     0.40499       1.001       0.405
                        regionSouth-East    -0.55677      1.0111      -0.551
                          regionSouthern     0.10589      1.0095       0.105
                        regionSouth-West     0.32633      1.0024       0.326
                          regionMidlands     0.50665      1.0038       0.505
                            regionLondon     0.11718       1.006       0.116
                        regionNorth-West      16.621      1.0133      16.403
----------------------------------------------------------------------------
173761      173761   regionE & W Ridings    -0.63382     0.63125      -1.004
                    regionNorth Midlands    -0.69774      0.3544      -1.969
                           regionEastern     -1.0848      0.4292      -2.528
                        regionSouth-East     -1.0587     0.70062      -1.511
                          regionSouthern      -1.031     0.77971      -1.322
                        regionSouth-West    -0.75518     0.40639      -1.858
                          regionMidlands     -1.3374     0.54592      -2.450
                            regionLondon     -1.1751     0.37585      -3.127
                        regionNorth-West     -1.1277     0.63813      -1.767
----------------------------------------------------------------------------
173762      173762   regionE & W Ridings    -0.63809     0.62765      -1.017
                    regionNorth Midlands    -0.74302     0.34879      -2.130
                           regionEastern     -1.0894     0.42326      -2.574
                        regionSouth-East     -1.0531     0.69589      -1.513
                          regionSouthern     -1.0327     0.76743      -1.346
                        regionSouth-West    -0.72386     0.40092      -1.805
                          regionMidlands     -1.3689      0.5499      -2.489
                            regionLondon      -1.177     0.37644      -3.127
                        regionNorth-West     -1.1317       0.637      -1.777
----------------------------------------------------------------------------
173767      173767   regionE & W Ridings     0.20983     0.62144       0.338
                    regionNorth Midlands     0.06599     0.30591       0.216
                           regionEastern    -0.14769     0.44357      -0.333
                        regionSouth-East     0.82081     0.64343       1.276
                          regionSouthern    -0.62109     0.74606      -0.833
                        regionSouth-West    -0.03987     0.46223      -0.086
                          regionMidlands    -0.32735     0.61056      -0.536
                            regionLondon    -0.78515     0.42325      -1.855
                        regionNorth-West     0.27804     0.48999       0.567
----------------------------------------------------------------------------
173769      173769   regionE & W Ridings      4.5881         NaN         NaN
                    regionNorth Midlands    -0.34476     0.77714      -0.444
                           regionEastern    -0.91347     0.52824      -1.729
                        regionSouth-East     -1.3439       1.081      -1.243
                          regionSouthern      4.6814     0.45549      10.278
                        regionSouth-West    -0.60396      0.9026      -0.669
                          regionMidlands      4.5527      0.7114       6.400
                            regionLondon      4.6776      0.7111       6.578
----------------------------------------------------------------------------
    173770 - No estimates available
----------------------------------------------------------------------------
173772      173772   regionE & W Ridings     0.51442      1.0059       0.511
                    regionNorth Midlands     -15.513      1.0002     -15.511
                           regionEastern     0.51587    0.059151       8.721
                        regionSouth-East    -0.47471     0.36987      -1.283
                          regionSouthern     0.13355     0.16895       0.790
                        regionSouth-West     0.45914    0.083373       5.507
                          regionMidlands     0.71392    0.095051       7.511
                            regionLondon     0.14812     0.14406       1.028
                        regionNorth-West     0.42546     0.22185       1.918
----------------------------------------------------------------------------
173774      173774   regionE & W Ridings    -0.58188     0.56282      -1.034
                    regionNorth Midlands     0.13666     0.35524       0.385
                           regionEastern    -0.31416     0.32302      -0.973
                        regionSouth-East      13.126         NaN         NaN
                          regionSouthern  -0.0071896     0.68956      -0.010
                        regionSouth-West     0.08923      0.4062       0.220
                          regionMidlands    -0.14467     0.56319      -0.257
                            regionLondon    -0.13347     0.60599      -0.220
                        regionNorth-West    -0.35987      0.7519      -0.479
----------------------------------------------------------------------------
173775      173775   regionE & W Ridings    -0.66611     0.58238      -1.144
                    regionNorth Midlands    -0.15507     0.28296      -0.548
                           regionEastern    -0.37129     0.30948      -1.200
                        regionSouth-East      -13.82      66.939      -0.206
                          regionSouthern     -1.2929     0.82212      -1.573
                        regionSouth-West    -0.57642     0.35407      -1.628
                          regionMidlands    -0.50419     0.45256      -1.114
                            regionLondon     -1.0341     0.53978      -1.916
                        regionNorth-West    -0.33239     0.69552      -0.478
----------------------------------------------------------------------------
173776      173776   regionE & W Ridings     0.17345     0.59392       0.292
                    regionNorth Midlands     0.27629     0.35001       0.789
                           regionEastern     0.23642     0.31759       0.744
                        regionSouth-East     -3.9329     0.32562     -12.078
                          regionSouthern      0.4868     0.73901       0.659
                        regionSouth-West     0.65519      0.3645       1.798
                          regionMidlands    0.076408     0.46793       0.163
                            regionLondon    -0.45808     0.76845      -0.596
----------------------------------------------------------------------------
Warning messages:
1: In sqrt(x$Var.beta[ii]) : NaNs produced
2: In sqrt(x$Var.beta[ii]) : NaNs produced

 Model  Y-variable  Parameter    Estimate        S.E.     z-value
-----------------------------------------------------------------
    173760 - No estimates available
-----------------------------------------------------------------
173761      173761     cccase     0.17833     0.14592       1.222
-----------------------------------------------------------------
173762      173762     cccase     0.20456     0.14603       1.401
-----------------------------------------------------------------
173767      173767     cccase    -0.12877     0.14544      -0.885
-----------------------------------------------------------------
    173769 - No estimates available
-----------------------------------------------------------------
    173770 - No estimates available
-----------------------------------------------------------------
    173772 - No estimates available
-----------------------------------------------------------------
    173774 - No estimates available
-----------------------------------------------------------------
    173775 - No estimates available
-----------------------------------------------------------------
    173776 - No estimates available
-----------------------------------------------------------------

 Model  Y-variable  Parameter    Estimate        S.E.     z-value
-----------------------------------------------------------------
173760      173760     cccase     -13.467      1.0027     -13.432
-----------------------------------------------------------------
173761      173761     cccase     0.18763     0.14553       1.289
-----------------------------------------------------------------
173762      173762     cccase     0.21178     0.14568       1.454
-----------------------------------------------------------------
173767      173767     cccase     -0.1287     0.14571      -0.883
-----------------------------------------------------------------
173769      173769     cccase      0.8949     0.53343       1.678
-----------------------------------------------------------------
    173770 - No estimates available
-----------------------------------------------------------------
    173772 - No estimates available
-----------------------------------------------------------------
173774      173774     cccase     0.17924      0.2148       0.834
-----------------------------------------------------------------
173775      173775     cccase      -0.188     0.19069      -0.986
-----------------------------------------------------------------
173776      173776     cccase    0.071589     0.23134       0.309
-----------------------------------------------------------------

snpStats documentation built on Nov. 8, 2020, 10:59 p.m.