element;intro
#Welcome;Welcome to ExploreModelMatrix! Here you can visualize and explore your design matrix in an interactive environment, and gain a better understanding of the meaning of the model coefficients and how they are related to your contrast of interest. <br><br>In this tour you will get an overview of the user interface. You can always leave the tour by pressing "Skip", or by clicking anywhere outside of the tour box. At any stage, you can access the tour by clicking on the question mark in the top right corner of the app.
#choose_design_formula;In this box you specify the desired (fixed-effect) design formula. The formula must start with the ~ character. <br><br>If you start the app without providing a sample table, there will also be a control here to select a tab-separated file with the sample information. After selecting the file, carefully check that all the columns have been correctly interpreted (e.g., in the Sample table summary panel). <br><br>All the controls in the sidebar are interactive, meaning that if you change one of them, the content displayed in the app will update accordingly.
#use_example_design;Instead of supplying your own sample table and design formula, you can choose to explore one of the built-in example designs, available in this dropdown menu.
#reflevels;These dropdown menus let you set or change the reference level for each of the factor variables in the supplied sample data table.
#dropcols;This box lets you specify columns to drop from the design matrix. This can be useful, e.g., to obtain a design matrix with full rank.
#settings;These menus allows you to change the settings for the plots. The menus can be expanded or collapsed by clicking on the small arrows to the right of the respective title.
#plotheight_fitted;This box sets the height of the plot window for the visualization of the fitted values.
#flipcoord_fitted;By checking this box, the x and y axes in the visualization of the fitted values are swapped. It can be useful, for example, if one predictor has many more levels than the other.
#textsize_fitted;This variable changes the font size of the matrix entries in the visualization of the fitted values.
#textsizelabs_fitted;This variable changes the font size of the axis labels in the visualization of the fitted values.
#colorterms_fitted;By checking this box, the terms in the visualization of the fitted values will be show in different colors.
#linewidth_fitted;This variable sets the maximal width of a line of text in the matrix visualizing the fitted values. Longer lines will be split (splits will only be done between different terms). If the terms are colored, there will always be one term per line (corresponding to setting the maximal line width to 1).
#fitted_values_plot_box;This plot shows the fitted values, in terms of the model coefficients (or more generally, the value of the linear predictor for a generalized linear model) for each combination of predictor values. <br><br>These values can be useful when deriving contrasts - for example, to get the contrast required to compare the fitted values in two cells in this table, take the linear combination given in the first cell and subtract the linear combination given in the second cell. This difference will tell you which linear contrast you need to specify to perform your test of interest.
#fitted_values_table_box;This panel contains the same information as the fitted value plot, but in table format.
#sample_table_box;This panel shows the full provided sample information table. You can collapse and expand each panel by clicking on the + or - symbol in the top right corner.
#sample_table_summary_box;This shows the summary of the provided sample information table. Character variables are converted to factors when loaded into the application.
#design_matrix_box;This panel displays the current design matrix, obtained by the model.matrix() R function applied to the specified design formula and sample data table, after excluding any columns specified under "Drop columns".
#design_matrix_rank_box;Here, the rank of the current design matrix, as well as the number of columns, are displayed. If the rank is lower than the number of columns (i.e., the design matrix is not full rank), a warning will be displayed. You will also see the residual degrees of freedom, calculated as the number of observations minus the rank of the design matrix. If this is zero, information such as variance or dispersion can not be estimated from data.
#pinv_design_matrix_box;This panel shows the pseudoinverse of the design matrix X. In a regular linear model of the form y=Xb+e, the ordinary least squares estimates of the regression coefficients are obtained by multiplying the pseudoinverse of X with the observed response values y, that is, $$\hat{\beta}=(X^TX)^{-1}X^Ty$$. Thus, the pseudoinverse indicates how the response variable values for the different samples contribute to the estimated model coefficients in a linear model.
#vifs_box;This panel displays the estimated variance inflation factors (VIFs) for the model coefficients, calculated by successively modeling each non-intercept column of the design matrix as a function of the other columns, using a linear model. For each variable, the VIF is obtained as 1/(1-R^2), where R^2 is the coefficient of determination of the linear model. In an ordinary least squares regression analysis, the VIF provides a measure of the increase in a coefficient's variance caused by collinearity with the other predictors in the model. The VIF for a predictor is 1 when the corresponding column of X is orthogonal to all other columns, and larger than 1 otherwise.
#cooccurrence_matrix_box;The co-occurrence plot displays the number of observations (rows in the sample data table) for each combination of predictor values. It can be useful in order to visualize whether the setup is balanced, or whether some combinations of predictors are not represented by any observations.
#correlation_matrix_box;This panel shows the correlation among the regression coefficients. In a regular linear model y=Xb+e, the variance-covariance matrix for the vector of regression coefficients b is proportional to (X^TX)^{-1}. This panel shows the matrix (X^TX)^{-1}, converted to a correlation matrix.
#goodbye;Thank you for taking the tour of ExploreModelMatrix!

