Giter Site home page Giter Site logo

plan-b's Introduction

Instructions on how to use the code

contents

This repo has three files:

multinom3.R the code you need to source for use,

simulation_multinom.R simulation code to see how model works,

test_on_data_multi.R code for test model on real data set

prerequisite packages

You need to download partitions package and install it first on R.

Usage

This code is used to implement a nonparametric bayesian regression model for multinomial responses and continuous predictor. The model is based on this paper.

The only function you need to use is manysteps_multinom, note there are several parameters need to be given as input.

y as the response data, should be a matrix of 1 and 0 where rows equals number of categories and columns equals number of observations.

m is the minimum number of each chunk,

k is the number of chunks.

R is the length of MCMC

ct is the number of categories.

Example

> dat = rmultinom(100,1,c(0.3,0.5,0.2))

> foo = manysteps_multinom(dat,m=5,k=10,R=1e3,ct=3)

> foo[[1]]

[1] 0.624

> foo[[2]][,1:4]

[,1] [,2] [,3] [,4]

[1,] 0.47418990 0.47418990 0.47418990 0.47418990

[2,] 0.48429465 0.48429465 0.48429465 0.48429465

[3,] 0.04151545 0.04151545 0.04151545 0.04151545

plan-b's People

Contributors

duanweikang avatar

Watchers

 avatar

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.