background preloader


Facebook Twitter


Print two conformable trellis plots in adjacent columns. Description Print two conformable trellis plots in adjacent columns with user control of widths.

Print two conformable trellis plots in adjacent columns

Left y tick-labels and left.strip are removed from the right-hand plot. Usage as.TwoTrellisColumns5(left, ## left is the left trellis object right, ## right is the right trellis object ## Both left and right must have identical ## settings for number and size of vertical panels, ## left-axis labels, number of lines in main, sub, legend. ..., pw=c(.3, .30, .01, .30, .09), px=list( LL=c(0, pwc[1]), LP=pwc[1:2], ML=pwc[2:3], RP=pwc[3:4], RL=pwc[4:5]), pwc=cumsum(pw), strip.left=TRUE, y.tck=c(0,0) ) ## S3 method for class 'TwoTrellisColumns5' print(x, px=attr(x, "px"), ...) leftLabels.trellis(x) rightLabels.trellis(x) panelOnly.trellis(x, strip.left=FALSE, y.tck=0) mainSubLegend.trellis(x) emptyRightAxis(x) Arguments Details as.TwoTrellisColumns5 constructs a "TwoTrellisColumns5" object, which is a list of five trellis objects named "LL", "LP", "ML", "RP", "RL".

Value. Coxcomb Plots and Spiecharts. Factor Structure vs. Correlation Network Maps. The psych R package includes a data set called "bfi" with self-report ratings on 25 personality items along a 6-point agreement scale.

Factor Structure vs. Correlation Network Maps

All the details are provided in the documentation accompanying the package. My focus is how to represent the correlations among these ratings: factor analysis or network graphics? Let's start with the correlation network map produced by the R package qgraph. As always, all the R code can be found at the end of this post. First, we need to discover the underlying pattern, so we will begin by looking for nodes with the highest correlations and thus interconnected with the thickest lines. Using this approach, we can identify several regions that are placed near each other because of their interconnections.

Next, we can compare this network representation with the more traditional factor model. The network model provides an alternative account. Which of these two representations is better? R code to create the two plots: Created by Pretty R at Visualizing transitions with the transitionPlot function. As an orthopaedic surgeon I’m often interested in how a patient is doing after surgery compared to before.

Visualizing transitions with the transitionPlot function

I call this as a transition between states, e.g. severe pain to moderate pain, and in order to better illustrate these transitions I’ve created something that I call a transition plot. It’s closely related to the plotMat for plotting networks but aimed at less complex relations with only a one-way relation between two groups of states. Linear regression from a contingency table. This morning, Benoit sent me an email, about an exercise he found in an econometric textbook, about linear regression.

Linear regression from a contingency table

Consider the following dataset, Here, variable X denotes the income, and Y the expenses. Gifi Methods for Optimal Scaling in R: The Package homals - paper. Analysing ordinal variables. Ordinal variables create challenges for analysis.

Analysing ordinal variables

This post discusses: (a) definitions and distinctions related to ordinal variables, (b) theoretical issues related to ordinal variables, and (c) options for analysing ordinal variables.Definitions: Ordinal variables can be defined in different ways (e.g., UCLA, Colorado State, wiktionary). Ordinal variables are ordered categorical variables. In this framework, they are distinguished from unordered categorical variables (i.e., nominal variables like favourite colour, country of birth, first name and so on) and from numeric variables (i.e., variables where the distance between each point on the scale is equal). Ordered categorical variables (along with unordered categorical variables and discrete numeric variables) are also distinguished from continuous variables (e.g., weight, height, time), where there is assumed to be an infinite number of points between any two points on the scale.

Additional Resources: Doughnut chart in R with googleVis. The guys at Google continue to update and enhance the Chart Tools API.

Doughnut chart in R with googleVis

One new recent feature is a pie chart with a hole, or as some call them: donut charts. Thankfully the new functionality is being achieved through new options for the existing pie chart, which means that those new features are available in R via googleVis as well, without the need of writing new code. Doughnut chart example With the German election coming up soon, here is the composition of the current parliament.