Learn R Programming

ViSiElse (version 1.0.1)

buildViSiGrid: Function buildViSiGrid

Description

The function buildViSiGrid build an object class ViSigrid with at least an object class ViSibook and data of individual realisation times for each punctual action defined in the ViSibook.

Usage

buildViSiGrid(X, book, Xsup = NULL, method = "global", group = NULL, grwithin = NULL, informer = "median", tests = TRUE, threshold.test = 0.01, quantity = "N", pixel = 20, t_0 = 0, sorted.line = TRUE, decrgr2 = FALSE, max_tps = NULL, colvect = NULL, ncolvect = dim(X)[1], times = FALSE, timeformat = c("hh:mm:ss"), idsubject = 1)

Arguments

X
A data.frame or matrix. X stores punctual action realization times. The actions are defined in book, and X columns names should correspond to the slot "vars" of book. X must also have a column to identify individuals.
book
A ViSiBook object. It stores the process structure.
Xsup
A data.frame or matrix storing supplementary time data, all indivuals in Xsup must be in X.
method
In { "global" , "cut" , "join" , "within" }. method specifies the plotting method, see details. If group is NULL, method is set to "global".
group
A factor with two levels. group indicates the group attributed to the individuals, it has same the length as the number of rows of X.
grwithin
A level of group. If method is set to within, grwithin specifies the group to consider.
informer
In { "NULL" , "median" , "mean" }. If informer is set to "median" the median and quartiles are computed, if it is set to "mean" the mean and standard deviation are. If informer is NULL no indicators are computed.
tests
A boolean. When informer is not NULL and group is defined, if tests is TRUE, tests are computed to compare groups. If the parameter informer is set to "mean", the function wilcox.test() is used, if informer is set to "median" the function mood.test() is used.
threshold.test
A numeric between 0 and 1. threshold.test is the value of the p-value under which the H0 hypothesis of the test is rejected when tests is TRUE.
quantity
In { "N" , "dens" }. quantity allows choosing the quantity represented for punctual action When quantity is set to "N" the number of individuals is considered. Otherwise when it is set to "dens" proportion of individuals is considered instead. If group is defined and method set to "cut" or "within", this proportion is calculated regarding each represented group.
pixel
An integer. It is the number of unit of time under which individuals are aggregated in the plot.
t_0
either 0, either a value of the slot "vars" in book, t_0 indicates the starting time to plot.
sorted.line
A boolean. When sorted.line is TRUE, it allows long actions to be sorted by starting time.
decrgr2
A boolean. When sorted.line is TRUE and decrgr2 is TRUE, long actions of the second group are plotted in decreasing order by starting times.
max_tps
A numeric, >0. max_tps is the maximum time used to build the grid in the plot. max_tps is useful when Xsup is given. If max_tps is NULL it is automatically computed.
colvect
A matrix containing colors. Colors are automatically computed if colvect is NULL. If group is not NULL colvect should have two rows otherwise one.
ncolvect
A numeric. ncolvect indicates the number of columns of colvect. Its default setting is dim(X)[1]. ncolvect is considered only if colvect is NULL.
times
A boolean. If times is TRUE, it incidicates that X contains data in a time format.
timeformat
time format. If times is TRUE.
idsubject
An integer betweem 1 and dim(X)[2]. idsubject indicates the number of the column of X that contains individuals id numbers.

Value

a ViSigrid object.

Details

  • method
    • global : The plot of the ViSigrid object returned will not consider the parameter group and plot indistinctly all individuals.
    • cut : In the plot of the ViSigrid object returned each group will be plotted apart within each action line.
    • join : In the plot of the ViSigrid object returned groups will be plotted gathered within each action line.
    • within : In the plot of the ViSigrid object returned , within each action line, there will be two lines, as for the method cut, the difference is that the first line will plot all individuals and the second one individuals belonging to the group specified in grwithin.
  • informer

    The parameter informer allows choosing an indicator. informer can take three values:

    • median: Median and quartiles are calculated for each action, using the function quantile from the package stats. This is the default value.
    • mean: Mean and standard deviation are calculated for each action, using the functions mean and var from the package stats.
    • NULL: no indicators are computed.

    When a group is declared indicators are calculated by group if the method cut or within is chosen.

    When plotting the ViSigrid object, indicators for a punctual action are represented by white circles linked by a line. For long action, only a black line is plotted from the median (or mean) of the punctal action staring it. The line length represents the median (or mean) of the long action duration. Informers are computed directly on the given matrix for punctual action. And for a long action it is calculated on the difference between the beginning punctual action and the ending one.

  • tests and threshold.test

    As for the parameter informer, tests are computed on the given matrix or data.frame X for a punctual action. And for a long action it is calculated on its difference between its beginning and ending punctual actions. In plot-ViSigrid-method, results of the tests are represented by a star only when the resulted p-value is bellow or equal to the parameter threshold.test.

  • pixel

    The parameter pixel represents the number of unit of time under which individuals are aggregated for punctual action in the plot. When the parameter pixel is too small the information represented will be too much aggregated to allow interpretation.

    For punctual actions data are aggregated in a matrix $M$ . The number of row of $M$ is the number of action and its number of columns is $[ ( max(X)-t_{0} )/pixel]$.

    $M_{i,j}$ contains the number of observations of the $i$-th punctual action (by the order of the ViSibook object) between $t_0 + (j-1)pixel$ included and $t_0 + j*pixel$ excluded.

  • t_0

    The origin of the graphic can be set using the parameter t_0. There is two ways to define it:

    • A number: set to 0__. It can be change at convenience, but for long actions black zones will not be drawn, and for punctual actions black and green zones will not be translated.
    • The name of a punctual action: To set the origin of the graphic to the moment when the action was done for each individual. Black and green zones will not be translated as well.

x can also has the colunms : GZDebn, GZFin, Repetition, BZBeforeDeb, BZBeforeFin, BZAfterDeb, BZAfterFin, BZLong , BZLtype

See Also

Dataset intubation. Classes ViSigrid and ViSibook. The method plot for ViSigrid object plot-ViSigrid-method for examples.