I'm currently dealing with multivariate dynamic time warping (DTW) in R. The best library I found so far is the dtw package as described here: http://dtw.r-forge.r-project.org/
But I do not know how multivariate dtw is actually implemented and it is also not described in the description of the package. All in all, I would like to know if it implements DTWD (Dependent DTW) or DTWI (Independent DTW).
Does anyone have an idea or a suggestion how to find out which of these two approaches the package uses? Or are there libaries which allow me to choose the variant?
You can always look at the companion papers that come with the packages for a more theoretical grounding of the packages
https://www.jstatsoft.org/article/view/v031i07
Additionally, you can always look into the "guts" of the functions to understand how things are implemented in the code
https://www.rdocumentation.org/packages/dtw/versions/1.20-1/source
As far as this question in general, perhaps it is better suited for https://stats.stackexchange.com/ where the questions are more methodological than programming.
The two types of multivariate dynamic time warping are carefully explained here
https://www.cs.ucr.edu/~eamonn/Multi-Dimensional_DTW_Journal.pdf
Related
I have been using the R exams package to create exams for my introductory statistics course this semester. It is really a great tool! I've been able to create several questions from scratch & import them to canvas without issue. However, there are some questions that give me problems when I try to import them (e.g., the anova and boxplot examples that are included in the package). I can successfully import if I use:
R> library("exams")
R> set.seed(1)
R> exams2canvas("anova.Rmd")
However, I sometimes run into problems when trying to create many versions of the same question:
R> library("exams")
R> exams2canvas("anova.Rmd", n=50)
TL;DR
The source of the problems are multiple-choice exercises with no correct alternative. These are not supported by learning management systems like Canvas or Moodle and hence exercises for these systems must assure at least one correct alternative and one wrong alternative.
Demo exercises
Some of the demo exercises in R/exams did not restrict the number of correct/wrong alternatives to a minimum of one. So from time to time it could happen that no alternative is correct. Up to version 2.3-6 of R/exams this affects the following exercises:
anova,
automaton,
boxplots,
cholesky,
relfreq,
scatterplot.
All of these have been adapted in version 2.4-0 (which was the development version of the package at the time of writing this answer).
Background
Multiple-choice exercises without correct alternatives are straightforward to handle without partial credits when the entire answer pattern must be fully correct. However, when using partial credits, no positive points can be obtained when there are no correct alternatives.
When we created the demo exercises in R/exams we adapted exercises from an environment where we did not use partial credits. But learning management systems like Moodle or Canvas expect at least one correct (and typically also one wrong) alternative for scoring it correctly with partial credits.
I am trying to solve a numerical equation in R but would want a method which perform similar to vpasolve in Matlab. I have a non linear equation (involving lot of log functions) which when solve in R with uniroot gives me complete different answer compared to what vpasolve gives in matlab.
First, a word of caution: it's often much more productive to learn that there's a better way to do something than the way you are used to doing.
edit
I went back to MATLAB and realized that the "vpa" collection is using extended precision. Is that absolutely necessary for your purposes? If not, then my suggestions below may suffice.
If you do require extended precision, then perhaps Rmpfr::unirootR function will suffice. I would like to point out that, since all these solvers are generating an approximate solution (as opposed to analytic), the use of extended precision operations seems a bit pointless.
Next, you need to determine whether MATLAB::vpasolve or uniroot is getting you the correct answer. Or maybe you simply are converging to a root that's not the one you want, in which case you need to read up on setting limits on the starting conditions or the search region.
Finally, in addition to uniroot, I recommend you learn to use the R packages BBsolve , nleqslv, rootsolve, and ktsolve (disclaimer: I am the owner and maintainer of ktsolve). These packages are pretty flexible and may lead you to better solutions to your original problem.
The question says it all. I am wondering whether there is an implementation of this specific regionalization algorithm in R. I found implementations of the SKATER and REDCAP algorithms but not the max-p region model.
I found one in using rgeoda - an R package GeoDa
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
Which R packages make good use of S4 classes? I'm looking for packages that use S4 appropriately (i.e. when the complexity of the underlying problem demands), are well written and well documented (so you can read the code and understand what's going on).
I'm interested because I'll be teaching S4 soon and I'd like to point students to good examples in practice so they can read the code to help them learn.
Thinking about this some more, maybe Matrix and/or lme4? Matrix does a lot of trickery with efficient representation of sparse matrices so this may be a worthwhile (though possibly heavy) example.
Else, given that all of BioConductor is done in S4, some of it is bound to be better than average :) I am sure Martin Morgan will pipe in with good examples.
This doesn't exactly answer your question, but....
R in a Nutshell develops an S4 class for a timeseries object and then compares it to the S3 representation. It's a very nice illustration (without being overly complex or too simple) of the differences between S3 and S4.
R programming for Bioinformatics briefly discusses the ExpressionSet set object.
In regards with using the Bioconductor packages, you might find that to fully appreciate the code - or even just to get started - you will have to a reasonable knowledge of biology. I suppose the same applies to complex statistics packages; you need to have a vague idea of what's going on to understand the reasons behind the code structure.
At the last LondonR meeting Brandon Whicher gave a fascinating talk about the use of S4 classes in his package dcemriS4, for use in analysing magnetic resonance imaging (MRI) in medical research.
His talk is available here:
http://www.londonr.org/Medical%20Image%20Analysis%20using%20S4%20classes%20&%20methods.pdf
And the package is on CRAN:
http://star-www.st-andrews.ac.uk/cran/web/packages/dcemriS4/index.html
sp and dependent packages use S4 and well documented. Alpha and omega for spatial stuff in R.
I would go for kernlab, which additionally includes a lot of C code.
It comes with an handy vignette, detailing some of S4 concepts. (It doesn't seem to use roxygen for the documentation, though, but this is not the question here.)
Trying to get a hold of the S4 system I ran across an educational package sequence. The implementation of the class system is illustrated in an accompanying set of slides in a repo roo by the same author. Though the example used is from biostatistics, it's good to follow.
It is a great learning resource, because the author took carefully contrasted the different object systems while at the same time keeping the complexity of the package adequate for learning.