spedygiorgio / markovchain

Easy Handling Discrete Time Markov Chains
https://spedygiorgio.github.io/markovchain/
Other
105 stars 39 forks source link

implement higher order markov chain classes and fits algorithm #52

Closed spedygiorgio closed 9 years ago

spedygiorgio commented 9 years ago

In general, there shoud be an S4 class containing the slots for the parameter, the name etc... Create a separate R file for the class (in R, use S4 and take inspiration from my markovchain s4 class), and a separate R file for the fit algorithm (in Rcpp).

have a look to http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.324.3297&rep=rep1&type=pdf and to clickstream package

tskang commented 9 years ago

What is the corresponding solnp function in c++ to solve the quadratic programming problem?

spedygiorgio commented 9 years ago

Hi Tae , use R package functions if not avoidable. I think that the R package that clickstreams author uses to perform QP problem is already in c++ so it suffices you To call it when necessary .

Best

Inviato da iPhone

Il giorno 17/ago/2015, alle ore 07:36, tskang notifications@github.com ha scritto:

What is the corresponding solnp function in c++ to solve the quadratic programming problem?

— Reply to this email directly or view it on GitHub.

tskang commented 9 years ago

I'm not sure what package you mean, but solnp which is used in clickstream is written in R, not c++. https://github.com/cran/Rsolnp/blob/master/R/solnp.R

So, I just implemented the fitting function in R. It returns the parameter lambda.

tskang commented 9 years ago

The following lines are tricky to convert to Rcpp as they involve environment to pass a function to solnp. environment(.fn1)=environment() Rsolnp::solnp(params, fun = .fn1, eqfun = .eqn1, eqB=1, LB=rep(0, order), control=list(trace=0))

I'm not sure how to do this in Rcpp.

tskang commented 9 years ago

It is done.