This post concludes the translation from LISREL’s to R’s of Iacobucci’s paper: Everything You Always Wanted to Know About SEM (Structural Equations Modeling) But Were Afraid to Ask. This post covers the full structural equation model.

Continue reading “Beginning with SEM in lavaan III”

# data visualization

# Beginning with SEM in lavaan II

This post continues the getting started with structural equation modeling series inspired by Dawn Iacobucci’s article: Everything You Always Wanted to Know About SEM (Structural Equations Modeling) But Were Afraid to Ask. In the series, I translate Iacobucci’s LISREL syntax into R lavaan’s.

# Beginning with SEM in lavaan

While reordering some old papers I rediscovered a paper by Dawn Iacobucci introducing structural equation modeling: Everything You Always Wanted to Know About SEM (Structural Equations Modeling) But Were Afraid to Ask. I liked Iacobucci’s introduction to SEM because it was eloquently written, clear and accessible. Moreover, Iacobucci accompanied the paper with a data-set and step-by-step explanation of the syntax to analyze it. This allowed the reproduction of her analysis to all the adventurous readers willing to start with structural equation modeling. Iacobucci used LISREL for the data-analysis and, at the time, I had no access to LISREL. Now, however, with lavaan available, when I encountered the paper again I saw an opportunity to make her approach reproducible by a wider audience since lavaan is available to anyone and its syntax is very intuitive. In this post I translate Iacobucci’s LISREL syntax to lavaan.

Continue reading “Beginning with SEM in lavaan”

# Can we make it 5?

This follows up on the four dimensions in two dimensions post. I updated the graph adding some functionality, increasing the readability and improving the aesthetics. Moreover, the plot can now transition from a visualization with two categorical variables to one with four. The principle guiding the creation of the graph remains the same: to display as much information as possible into a two-dimensional graph without sacrificing interpretability and maintaining (hopefully) pleasing aesthetics. Because of the addition of the transition effect, I thought it was like adding a new dimension to the four which already existed. Below I describe the implementation of these additions. The graph is made in d3.js and the final plot can be admired here.

# Web-interface for Delphi Method III

This post is the third in the series describing the web-interface I created to administer a questionnaire with the Delphi method. In this post I describe the code used to give feedback to the participants in round 2 of the Delphi study on functional magnetic resonance imaging on tinnitus. If you are interested in the previous posts, this post describes the interface for round 1 whereas this post describes (the first part of) the interface for round 2.

Continue reading “Web-interface for Delphi Method III”

# Streamgraph in R [final]

This post is an update on the previous post translating Byron and Wattenberg’s streamgraphs algorithm into R. Byron and Wattenberg’s algorithm produces beautiful streamgraphs with the synthetic data produced by their streams generator. However, the implementation yields an ugly streamgraph when applied to data which might not be as wiggly as the synthetic ones. In the attempts I made I got very peaky wiggles, not smoothed and irregular. In short the graphs did not transmit the idea of a stream, but of a blurry blob or a peaky primitive bat (the wooden club, not the animal, that would be cool!). In this post I bring-up some points to bear in mind when producing a streamgraph. Continue reading “Streamgraph in R [final]”

# Streamgraphs in base::R [e.III]

This is the third post on streamgraph in R. After a simple introduction on how to generate a streamgraphs and an example with actual data it was time for a more general implementation to the creation streamgraphs using R. Continue reading “Streamgraphs in base::R [e.III]”

# Plotting multiple mediation

This posts on multiple mediation on lavaan supplements the two previous ones (1 – introducing multiple mediator analysis with lavaan and 2 – showing an example analysis) by describing how to process lavaan’s output graphically. I discovered the handy package semPlot and I am very positive about it. I will make the example as reproducible as possible, so that each step can be repeated. Also, I am going to try to provide more explanation about the R commands I used because a friend pointed out that the description of the steps was sometimes a bit dry and abstract.

Continue reading “Plotting multiple mediation”

# Four dimensions in two dimensions

This scatterplot is one of the best data visualisation I made. I like it because it concentrates a lot of information into a single visualisation. The scatterplot displays four dimensional data (i.e., four variables) using a two dimensional scatterplot. I made the first implementation in R, but because I wanted to add interactivity I switched to d3.js. Below I describe the choices I made to display the information and how I coded them in d3.js. Continue reading “Four dimensions in two dimensions”

# Streamgraphs in base::R [e.II]

Until recently I did not have a practical application in which to use streamgraphs. In fact, I still find the visualisation complex to understand, abstract and a bit too artistic. While I recognise that the strength of streamgraphs is the display of all the time seriesâ€™ values into one (possibly interactive) plot, the amount of data displayed is massive, with many streams and even more data points. Because of the amount of data displayed Continue reading “Streamgraphs in base::R [e.II]”