Print two conformable trellis plots in adjacent columns. Description Print two conformable trellis plots in adjacent columns with user control of widths. 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), 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 Author(s) Richard M. See Also. 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. 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. Red lines indicate negative correlations (e.g., those who claim that they are "indifferent to others" are unlikely to tell us that they "inquire about others" or "comfort others"). Using this approach, we can identify several regions that are placed near each other because of their interconnections.
The network model provides an alternative account. 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. 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. This project started by me posting a question on Stack Overflow, the answers were (as always) excellent, but didn’t really satisfy my needs.
What I wanted was a graphically appealing plot that I could control in extreme detail. In this post I’ll give a short introduction with examples to what you can do with the transitionPlot()-function. Simulate some data To illustrate a simple example we’ll generate some data, imagine having a questionnaire for pre- and postoperative pain graded none, moderate, or major. Simple example Simple with a twist Summary. 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.
Consider the following dataset, Here, variable X denotes the income, and Y the expenses. The goal was to fit a linear regression (actually, in the email, it was mentioned that we should try to fit an heteroscedastic model, but let us skip this part). So Benoit’s question was more or less: how do you fit a linear regression from a contingency table? Usually, when I got an email on Saturday morning, I try to postpone. > df=read.table(" > M=as.matrix(df[,2:ncol(df)]) > M[is.na(M)]<-0 > M X14 X19 X21 X23 X25 X27 X29 X31 X33 X35 [1,] 74 13 7 1 0 0 0 0 0 0 [2,] 6 4 2 7 4 0 0 0 0 0 [3,] 2 3 2 2 4 0 0 0 0 0 [4,] 1 1 2 3 3 2 0 0 0 0 [5,] 2 0 1 3 2 0 6 0 0 0 [6,] 2 0 2 1 0 0 1 2 1 0 [7,] 0 0 0 2 0 0 1 1 3 0 [8,] 0 1 0 1 0 0 0 0 2 0 [9,] 0 0 0 0 1 1 0 1 0 1 The first idea I had was to use those counts as weights.
Gifi Methods for Optimal Scaling in R: The Package homals - paper. Analysing ordinal variables. Ordinal variables create challenges for analysis. 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. 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.
Session Info R version 3.0.1 (2013-05-16) Platform: x86_64-apple-darwin10.8.0 (64-bit) locale:  en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8 attached base packages:  stats graphics grDevices utils datasets methods  base other attached packages:  googleVis_0.4.5 loaded via a namespace (and not attached):  RJSONIO_1.0-3 tools_3.0.1.