GithubHelp home page GithubHelp logo

mixturer's Introduction

mixturer

Travis build status Codecov test coverage

Overview

Translation of Paul Bays' Matlab functions for modelling precision data into R. The code is also as close as possible to the Matlab code 'under the hood'. The model implemented is described in:

The precision of visual working memory is set by allocation of a shared resource. Bays PM, Catalao RFG & Husain M. Journal of Vision 9(10): 7, 1-11 (2009).

Installation

remotes::install_github('eddjberry/mixturer')

Example

library(mixturer)

set.seed(1295)

response <- randomvonmises(1000, 0, 1)
target <- response + rnorm(1000, 0, 0.01)

df_test_von_mises <- data.frame(response, target)

df_test_von_mises$response_rad <- wrap(df_test_von_mises$response/90*pi)
df_test_von_mises$target_rad <- wrap(df_test_von_mises$target/90*pi)

(ests1 = bays_2009_fit(X = df_test_von_mises$response_rad, Tg = df_test_von_mises$target_rad, return.ll= F))
##   K   Pt Pn   Pu
## 1 1 0.99  0 0.01

Comparison to Matlab functions

The function names have been changes to have the prefix bays_2009_ to hopefully make it obvious that model is being used. The table below shows the Matlab function names as described in Bays' guide, and the equivalent function in this package.

Matlab function R function
JV10_error() bays_2009_error()
JV10_fit() bays_2009_fit()

Citation

Bays PM, Catalao RFG & Husain M. Journal of Vision 9(10): 7, 1-11 (2009).

Berry E (2019). mixturer: Mixture Models for Analogue Response Data. R package version 0.1.0.

Contributing

I did the orignal translation used for this package back in 2016. It could certainly been improved upon. In addition, there are a number of other models for continuous response data that have been proposed. If someone wanted to, the other models that Paul Bays has proposed could be translation into R and added to this package.

mixturer's People

Contributors

eddjberry avatar

Stargazers

Vivien Chopurian avatar Alba Morató Catafal avatar

Watchers

James Cloos avatar  avatar Alba Morató Catafal avatar

mixturer's Issues

Clean up internal code

This code was initially written in 2016. While it all works it could be cleaned up and made more readable

Fix bays_2009_fit() length warning

Currently calling bays_2009_fit() throws a warning about

number of rows of result is not a multiple of vector length

multiple times as it's looping through doing stuff.

Issue with sd2k function

Line 17 of sd2k function needs parentheses on the denominator. Currently, we get an error:

sd2k(0.3659424)
[1] 0.5295116

This value should return a K of 8. Correcting line 17 to the following fixes the issue:

K = 1 / (R^3 - 4 * R^2 + 3 * R)

sd2k(0.3659424)
[1] 7.995975

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.