Step-by-Step How-to on Mediation Analysis in R - r

I'd like to know if anybody can provide a step-by-step how to on how to use mediation analysis using Keele, Tingley, Yamamoto and Imai's mediation package. I think there are two approaches to this - the classic Baron and Kenny (1986) and the new one by Preacher, Rucker and Hayes (2007) - I'd like to know how to do both approaches in R

In case you not familiar with R and packages, start with
install.packages(mediation)
to download and install the package from CRAN. Then do
library(help=mediation)
for a high-level view of the package, and available help files. Then use
library(mediation)
help(mediate)
to load the package and read the help page. The example can be run via
example(mediate)
and you can run the other example for sensitivity analysis via
example(medsens)

This vignette is what you are looking for, if the above answer isn't enough.
It's about as hand-holdy as you can get with this sort of thing.

Related

Using ConsRank in R Studio

Installed both R studio and ConsRank package but i have little R and Math knowledge.
I need to understand how to calculate and reach the result of the formula in attached files.
To solve this problem, correlation coefficient τx used which is intruduced by Emond and Mason (2002)
I tried to use ConsRank functions but my R knowledge was not enough.
FormulaFormula
MatrixMatrix
ResultResult
The first step is to install and load the package ConsRank using the following codes:
install.packages('ConsRank', dependencies=T)
library(ConsRank)
If you successfully load the package, you are good to go. The next step is to read the documentation of the package (Click Here) in which you will learn about what functions you will need and there are some different examples that help you understand the input and outputs.
Let me know if you needed any help running your scripts. Good Luck.

How to use weight with the package "crsosstable" for R

The crosstable package give me exactly what I need to do some exploratory work in a data set composed of answers to a survey. But I need to weight the crosstabulation to get a representative results of the population I'm studying. Any ideas how I could use weights with this package?
So far I have used the "survey" package to do that, but it's lacking presentation tool to get publication ready tables.
Thanks.
I'm the dev of the crosstable package and it is unfortunately not supporting weights yet.
I would love to implement this as a feature one day, so you should definitely open a Feature Request on GitHub.
As I've never had to do a weighted description myself, please add a simplified version of your use case so that I can make something useful to everyone.

R functions using SentiWordNet

I am doing sentiment analysis and text mining on an e-mail box dedicated for client feedback. I use R for this work. I based the sentiment analysis on the work done by Jeffrey Breen. It works fine but I want to take it a step further. During my research I came across SentiWordnet.
I searched for R-code/functions to be able to apply SentiWordNet but only came up with Java and Python resources. I am not at all familiar with either of these.
Is there someone who applied SentiWordNet in R? I will appreciate any assistance.
As of 2019 the Lexicon package by Tyler Rinker (available on CRAN) contains the SentiWordnet dataset.
I can't find any example of SentiWordNet accessed solely from R, however you could call the Python package from R using rPython, or the Java implementation using rJava (some notes provided here). Unfortunately the python implementation is not currently available for Windows.

How can I create a Coincidence Matrix in R using R Studio?

I want to create a conincidence matrix using R Studio for a decision tree that I have generated. I have done the same in SPSS but am not able to figure out how to do the same in R. I am attaching an image of how it looks in SPSS. If you could point me to the right resource or link that can tell me what the quivalent of this in R is, that would be very helpful. Thank you!!
First, please try and ask targeted questions. What have you tried? What packages have you explored? Where are you getting stuck?
Nonetheless, I would start by reading through this, A Short Introduction to the caret Package. Then, do this:
install.packages("caret")
library(caret)
?confusionMatrix

R Package to Analyse Eye Tracking data

I was wondering if anyone out there has found a nice package for R to analyse eye-tracking data?
I came across eyetrackR but as far as I can tell there is no English support documentation available:
http://read.psych.uni-potsdam.de/pmr2/index.php?option=com_content&view=article&id=43:eyetrackr&catid=13:r-playground&Itemid=15
I will move onto another freeware that handles eye-tracking data if I need to but was really hoping there would be something accessible in R.
Ideas?
Cheers.
It would help if you could explain which kind of analyses you are intending to do. There are many different approaches depending on the research question and the research field. Many approaches involve the detection of fixations and saccades as a first step. An R package that can be used for fixation detection is called saccades and is available on CRAN. See also the Github page of the package for examples and screenshots.
A new eye-tracking analysis package for R (eyetrackingR) was recently released. It provides a variety of methods that handle data preparation/cleaning, visualization, and analysis.
Here's a list of several dozen instances of researcher contributed code (FOSS) for post-acquisition summarization and analysis of eye-movement data. You may be able to find something to suit your needs there.
List is provided in case anyone stumbling across this thread may find it useful.
https://github.com/davebraze/FDBeye/wiki/Researcher-Contributed-Eye-Tracking-Tools

Resources