KS.flowcytest            package:rflowcyt            R Documentation

_K_o_l_m_o_g_o_r_o_v _S_m_i_r_n_o_f_f _T_e_s_t _2-_s_a_m_p_l_e

_D_e_s_c_r_i_p_t_i_o_n:

     Provides a Kolmogorov Smirnoff 2-sample Test to determine if the
     distribution of the control data is different from the
     distribution of the stimulated data (for which both datasets are
     of the same variable).  See also the function 'ks.test' in the
     'stats'.  A density plot made by the function 'bkde' in
     'KernSmooth' package is also shown.

_U_s_a_g_e:

       KS.flowcytest(controldata, stimuldata,
                     title="", varname = "", yupper = 0.01,
                     xlimit = c(0, 1025), alternative="two.sided",
                     KS.plotted=TRUE,
                     MY.DEBUG=TRUE,...)

_A_r_g_u_m_e_n_t_s:

controldata: a vector of numeric values of the control data

stimuldata: a vector of numeric values of the stimulated/case data

   title: character string of the plot title

 varname: character string of the name of the variable

  yupper: the upper limit of the densities calculated

  xlimit: a vector indicating the range of the controldata and the
          stimuldata

alternative: character string of the alternative hypothesis:

          1.  "two sided" : Two sided alternative hypothesis

          2. "less": One sided alternative hypothesis: controldata
          distribution is less than the stimuldata distribution

          3.  "greater" One sided alternative hypothesis: controldata
          distribution is greater than the stimuldata distribution

KS.plotted: boolean to display the corresponding plot; default is TRUE
          and the plot will be displayed

MY.DEBUG: boolean; if TRUE, the test is printed out with comments; if
          FALSE then these comments are surpressed

     ...: parameters for the stimuldata distribution specified in
          'ks.test'

_D_e_t_a_i_l_s:

     In general, the control and the stimulated data come from the
     Interferon Gamma Data Variable of a FCS R object.

_V_a_l_u_e:

pval.2sid.KS: p value of the two sided Kolmogorov Smirnoff test

Alt.Hypoth.KS: The Alternative Hypthesis as a string

method.KS: the method used

dataname.KS: the name of the data

     A superimposed plot of the densities of the control and the
     stimulated dataset is also displayed.

_W_A_R_N_I_N_G:

     Usually the FCS object is gated and subset prior to this testing
     and analysis.

_N_o_t_e:

     Other flowcytests are available such as 'pkci2.flowcytest',
     'ProbBin.flowcytest', 'KS.flowcytest', which test the equivalence
     of two sample distributions. Generally, comparing the control and
     stimulated samples of the interferon gamma variable is of
     interest.

_A_u_t_h_o_r(_s):

     A.J. Rossini and J.Y. Wan

_R_e_f_e_r_e_n_c_e_s:

     See 'ks.test'

_S_e_e _A_l_s_o:

     'pkci2.flowcytest', 'ProbBin.flowcytest', 'runflowcytests',
     'ks.test', 'bkde'

_E_x_a_m_p_l_e_s:

      
         ## different distributions
         control<-rnorm(1000, mean=3, sd=.7)
         stimulated<-rnorm(1000, mean=2, sd=.5)

         if (interactive()==TRUE) {
           output.same <- KS.flowcytest(control, stimulated,
                                        title="Different Distributions",
                                        varname="Interferon Gamma",
                                        yupper=1, xlimit=c(-5,8))
         }
         ## same distribution
         stimulated2<-rnorm(1000, mean=3, sd=.7)
         if (interactive()==TRUE) {
           output.diff <- KS.flowcytest(control, stimulated2,
                                        title="Same Distributions",
                                        varname="Interferon Gamma",
                                        yupper=1, xlimit=c(-5,8))
         }

         ## obtaining the FCS objects from VRC data
         if (require(rfcdmin)) {
           data.there<-is.element(c("st.1829", "unst.1829", "st.DRT", "unst.DRT"),objects())
           if ((sum(data.there) != length(data.there))) {
             ## obtaining the FCS objects from VRC data
             data(VRCmin)
           }

           ## This only serves as an example.  Usually the FCS object is
           ## gated and then subset

           ## HIV negative individual 1829
           ## only the first 2000 cells are selected

           IFN.control<-unst.1829@data[1:2000,4]
           IFN.stimul<-st.1829@data[1:2000,4]
          
           if (interactive()==TRUE){
             KS.flowcytest(IFN.control, IFN.stimul,
               title="HIV Negative Individual 1829", varname="Interferon Gamma",
               yupper=.006)
           }
           ## HIV positive individual DRT
           ## only the first 2000 cells are selected

           IFN.control2<-unst.DRT@data[1:2000,4]
           IFN.stimul2<-st.DRT@data[1:2000,4]
           
           if (interactive()){

           KS.flowcytest(IFN.control2, IFN.stimul2,
                 title="HIV Positive Individual DRT", varname="Interferon Gamma",
                 yupper=.006)
         }
         ## This is an artifical example, but one would expect the
         ## distributions of the stimulated and control samples
         ## to be the same in the HIV negative individual 1829
         ## and to be different in the HIV positive individual DRT
         ## The test in this example is a bit contrived but
         ## the bigger picture is achieved.
       }
       

