This function performs Test3.SR
test3sr(X, freq, verbose = TRUE, rounding = 3)
X | is a matrix of encounter histories with K occasions |
---|---|
freq | is a vector of the number of individuals with the corresponding encounter history |
verbose | controls the level of the details in the outputs; default is TRUE for all details |
rounding | is the level of rounding for outputs; default is 3 |
This function returns a list with first component the overall test and second component a data.frame with 4 columns for components i (2:K-1) (in rows) of test3.sri: component, statistic of the test, p-value, signed test, test performed.
Olivier Gimenez <olivier.gimenez@cefe.cnrs.fr>, Jean-Dominique Lebreton, Rémi Choquet, Roger Pradel
# read in the classical dipper dataset dipper = system.file("extdata", "ed.inp", package = "R2ucare") dipper = read_inp(dipper,group.df=data.frame(sex=c('Male','Female'))) # Get encounter histories, counts and groups: dip.hist = dipper$encounter_histories dip.freq = dipper$sample_size dip.group = dipper$groups # split the dataset in males/females mask = (dip.group == 'Female') dip.fem.hist = dip.hist[mask,] dip.fem.freq = dip.freq[mask] mask = (dip.group == 'Male') dip.mal.hist = dip.hist[mask,] dip.mal.freq = dip.freq[mask] # Test3SR for males res.males = test3sr(dip.mal.hist, dip.mal.freq) res.males#> $test3sr #> stat df p_val sign_test #> 6.778 5.000 0.238 -1.530 #> #> $details #> component stat p_val signed_test test_perf #> 1 2 0.257 0.612 -0.507 Chi-square #> 2 3 1.668 0.197 -1.292 Chi-square #> 3 4 3.946 0.047 -1.986 Chi-square #> 4 5 0.218 0.641 -0.467 Chi-square #> 5 6 0.689 0.406 0.83 Chi-square #>