Is there an R package for learning a Dirichlet prior from counts data - math

I'm looking for a an R package which can be used to train a Dirichlet prior from counts data. I'm asking for a colleague who's using R, and don't use it myself, so I'm not too sure how to look for packages. It's a bit hard to search for, because "R" is such a nonspecific search string. There doesn't seem to be anything on CRAN, but are there any other places to look?

I've only come across both R and the Dirichlet distribution in passing, so I hope I'm not too much off the mark.
This mailing list message seems to answer your question:
Scrolling through the results of
RSiteSearch("dirichlet") suggests some useful tools
in the VGAM package. The gtools package and
MCMC packages also have ddirichlet() functions
that you could use to construct a (negative log) likelihood
function and optimize with optim/nlmin/etc.
The deal, DPpackage and mix packages also may or may not provide what you need.
Then again, these are all still CRAN packages, so I'm not sure if you already found these and found them unsuitable.
As for searching for R, the R project site itself already provides a few links on its search page.

Related

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 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

pairwise.wilcox.test() after friedman.test() in R

Can I use pairwise.wilcox.test() for post hoc test as my friedman.test() gat sifnificant?
I can't install pgirmass for the friedmanmc() function as its not compatible with my R version.
Does pairwise.wilcox.test() make sense for more than two samples?
Thank you for your help!
You haven't offered a specific example or an explanation of the the study design and hypotheses being tested, but the documentation does say that "corrections for multiple testing" are made, so you should be reasonably safe on statistical grounds. (There is some debate about the need for multiple comparisons tests.)
On the topic of the other package, you are misspelling its name and there is a current version available from CRAN for pkg:pgirmess. After reading the documentation of the two tests, I would probably trust the pairwise.wilcox.test more than the friedmanmc test because it is in a core R package, while the friedmanmc test appears to have undesireable behavior that gets suppressed in an awkward fashion, leading me to think it uses something of a statistical hack. I'm not encouraging you to do so but if your unstated R version is somewhat older, there may be suitable package versions, since I see versions going back to 2005 in the Archives.

Bivariate Poisson Regression in R?

I found a package 'bivpois' for R which evaluates a model for two related poisson processes (for example, the number of goals by the home and the away team in a soccer game). However, this package seems to no longer be useable in newer versions of R.
Is there a reasonable way to modify the glm() function to do a similar process, or run this older package on my new version of R? I have found very little literature on these sorts of processes and have found very little in terms of easy implementation in other statistical packages like STATA.
Any suggestions would be much appreciated.
While CRAN does not host a current binary of bivpois, you can build the package from the archived source code (see http://cran.r-project.org/doc/manuals/R-exts.html#Checking-and-building-packages ). Building bivpois 0.50-3.1 from source (available at http://cran.r-project.org/src/contrib/Archive/bivpois/) works for me on R 2.15.0 Windows x64. The zipped Windows binary I built is available here: http://commondatastorage.googleapis.com/jthetzel-public/bivpois_0.50-3.1.zip .
You can feel free to refer to odds modelling and testing inefficiency of sports-bookmakersas I had modified the relevant functions inside bivpois package.

Implementation of Particle Swarm Optimization Algorithm in R

I'm checking a simple moving average crossing strategy in R. Instead of running a huge simulation over the 2 dimenional parameter space (length of short term moving average, length of long term moving average), I'd like to implement the Particle Swarm Optimization algorithm to find the optimal parameter values. I've been browsing through the web and was reading that this algorithm was very effective. Moreover, the way the algorithm works fascinates me...
Does anybody of you guys have experience with implementing this algorithm in R? Are there useful packages that can be used?
Thanks a lot for your comments.
Martin
Well, there is a package available on CRAN called pso, and indeed it is a particle swarm optimizer (PSO).
I recommend this package.
It is under actively development (last update 22 Sep 2010) and is consistent with the reference implementation for PSO. In addition, the package includes functions for diagnostics and plotting results.
It certainly appears to be a sophisticated package yet the main function interface (the function psoptim) is straightforward--just pass in a few parameters that describe your problem domain, and a cost function.
More precisely, the key arguments to pass in when you call psoptim:
dimensions of the problem, as a vector
(par);
lower and upper bounds for each
variable (lower, upper); and
a cost function (fn)
There are other parameters in the psoptim method signature; those are generally related to convergence criteria and the like).
Are there any other PSO implementations in R?
There is an R Package called ppso for (parallel PSO). It is available on R-Forge. I do not know anything about this package; i have downloaded it and skimmed the documentation, but that's it.
Beyond those two, none that i am aware of. About three months ago, I looked for R implementations of the more popular meta-heuristics. This is the only pso implementation i am aware of. The R bindings to the Gnu Scientific Library GSL) has a simulated annealing algorithm, but none of the biologically inspired meta-heuristics.
The other place to look is of course the CRAN Task View for Optimization. I did not find another PSO implementation other than what i've recited here, though there are quite a few packages listed there and most of them i did not check other than looking at the name and one-sentence summary.

Resources