Name | Modified | Size | Downloads / Week |
---|---|---|---|
README.rtf | 2019-10-09 | 1.8 kB | |
seropositivity.R | 2019-10-09 | 6.1 kB | |
Totals: 2 Items | 7.9 kB | 0 |
{\rtf1\ansi\ansicpg1252\cocoartf1671\cocoasubrtf600 {\fonttbl\f0\fswiss\fcharset0 Helvetica;} {\colortbl;\red255\green255\blue255;} {\*\expandedcolortbl;;} \margl1440\margr1440\vieww10800\viewh8400\viewkind0 \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 \f0\fs24 \cf0 The file seropositivity.R contains 3 functions:\ \ The function Gaussian_mixture_EM(Data, N) simply calls the package mclust and estimates parameters for the best fitting Gaussian Mixture Model (GMM) using expectation maximization.\ \ Example 1:\ # Randomly generate GMM data\ Data = c(rnorm(100,3,1),rnorm(10,6,2))\ \ # Call the function for N=2 Gaussian components\ EM = Gaussian_mixture_EM(Data, 2)\ \ # Output includes:\ EM$Data\ EM$McLust\ EM$Summary\ \ \ The function Gaussian_mixture_MLE(EM_fit) takes the output of Gaussian_mixture_EM(Data, N) as its input and computes a maximum likelihood estimation for the best fitting parameters. \ \ NOTE: because this is a \'93brute force\'94 technique the process may take a very long time. Parameters that change are printed out until the MLE ends.\ \ Example 2:\ # Using the EM output from Example 1 as the input\ MLE = Gaussian_mixture_MLE(EM)\ \ # Output includes:\ MLE$Data\ MLE$Initial_params\ MLE$MLE_params\ \ \ The function bootstrap_ks_GMM(GMM, trials) takes the output of Gaussian_mixture_MLE(EM_fit) as its input and implements a parametric bootstrapping procedure to compute the KS statistics for each component of the GMM for each trial as well as a p-value for each component.\ \ Example 3:\ # Using the MLE output from Example 2 as the input with 1000 trials\ BTS = bootstrap_ks_GMM(MLE, 1000)\ \ # Output includes:\ BTS$KS_stat_seronegative\ BTS$KS_stat_seropositive\ BTS$KS_seroN_pvalue\ BTS$KS_seroP_pvalue}