# v_prob2berk

## PURPOSE

V_PROB2BERK convert probability to Berksons

## SYNOPSIS

function [b,d]=v_prob2berk(p)

## DESCRIPTION

    V_PROB2BERK convert probability to Berksons

      Inputs:  P(M,N)       matrix containing probability values

     Outputs:  P(M,N)       Corresponding Berkson values
               D(M,N)       Corresponding derivatives dP/dB

     Berksons, or log-odds, are a nonlinear scale for measuring
     probability defined by B = log2(P./(1-P)).
     When Berksons are used to measure probability, a logistic
     psychometric function becomes linear.

     The inverse function is v_berk2prob()

## CROSS-REFERENCE INFORMATION

This function calls:

This function is called by:

## SOURCE CODE

    0001 function [b,d]=v_prob2berk(p)
    0002 %V_PROB2BERK convert probability to Berksons
    0003 %
    0004 %  Inputs:  P(M,N)       matrix containing probability values
    0005 %
    0006 % Outputs:  P(M,N)       Corresponding Berkson values
    0007 %           D(M,N)       Corresponding derivatives dP/dB
    0008 %
    0009 % Berksons, or log-odds, are a nonlinear scale for measuring
    0010 % probability defined by B = log2(P./(1-P)).
    0011 % When Berksons are used to measure probability, a logistic
    0012 % psychometric function becomes linear.
    0013 %
    0014 % The inverse function is v_berk2prob()
    0015
    0016 %      Copyright (C) Mike Brookes 2014
    0017 %      Version: $Id: v_prob2berk.m 10865 2018-09-21 17:22:45Z dmb $
    0018 %
    0019 %   VOICEBOX is a MATLAB toolbox for speech processing.
    0020 %   Home page: http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/voicebox.html
    0021 %
    0022 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    0023 %   This program is free software; you can redistribute it and/or modify
    0024 %   it under the terms of the GNU Lesser General Public License as published by
    0025 %   the Free Software Foundation; either version 3 of the License, or
    0026 %   (at your option) any later version.
    0027 %
    0028 %   This program is distributed in the hope that it will be useful,
    0029 %   but WITHOUT ANY WARRANTY; without even the implied warranty of
    0030 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0031 %   GNU Lesser General Public License for more details.
    0032 %
    0033 %   You can obtain a copy of the GNU Lesser General Public License from
    0034 %   https://www.gnu.org/licenses/ .
    0035 %
    0036 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    0037 b=log2(p./(1-p));
    0038 if nargout>1
    0039     d=log(2)*p.*(1-p);
    0040 end