Distribution that potentially produce S shaped cond . prob .

Author : Martin Horvat, January 2025

Beta prime distribution

Model

Clear[f,A,g];
g[x_,α_,β_,γ_]:=x^α(γ+x)^(β-α)
A[α_,β_,γ_]=FullSimplify[Integrate[g[x,α,β,γ],{x,0,Infinity},Assumptions->α>-1&&β<-2&&γ>0]]
f[x_,α_,β_,γ_]:=g[x,α,β,γ]/A[α,β,γ]

meanf[α_,β_,γ_]=Integrate[x f[x,α,β,γ],{x,0,Infinity},Assumptions->α>-1&&β<-2&&γ>0]

mom2f[α_,β_,γ_]=Integrate[x^2 f[x,α,β,γ],{x,0,Infinity},Assumptions->α>-1&&β<-3&&γ>0]

var2f[α_,β_,γ_]=Integrate[(x-meanf[α,β,γ])^2 f[x,α,β,γ],{x,0,Infinity},Assumptions->α>-1&&β<-3&&γ>0]

Note : Conditional prob (Y=1| x) = 1/(1+ const r(x) )

Clear[r,check0,check1];
(* ratio of distributions *)
r[x_,{α0_,β0_,γ0_,α1_,β1_,γ1_}]:=f[x,α0,β0,γ0]/f[x,α1,β1,γ1];

(* normalization condition *)
check0[{α0_,β0_,γ0_,α1_,β1_,γ1_}]:=(α0>-1)&&(β0<-2)&&(α1>-1)&&(β1<-2)&&(γ0>0)&&(γ1>0); 

(* S curve condition *)
check1[{α0_,β0_,γ0_,α1_,β1_,γ1_}]:=(α0-α1<0)&&(β0-β1<0);

Tests

Plot[f[x,-0.5,-2,1],{x,0.001,10}]

p={1,-4,1,3,-3,2}
Print["check0=",check0[p]]
Print["check1=",check1[p]]
Print["mean0=",meanf[p[[1]],p[[2]],p[[3]]]]
Print["mean1=",meanf[p[[4]],p[[5]],p[[6]]]]
r[x,p]

Plot[f[x,p[[1]],p[[2]],p[[3]]],{x,0,10},PlotRange->All]
Plot[f[x,p[[4]],p[[5]],p[[6]]],{x,0,10},PlotRange->All]
Plot[1/(1+r[x,p]),{x,0,10},PlotRange->All]

Plot[1/(1+r[x,p]),{x,0,10},PlotRange->All]

Discussing general case of r (x)

FullSimplify[r[x,{α0,β0,γ0,α1,β1,γ1}]]

Beta prime distribution

Model

Clear[f,A,g];
g[x_,α_,β_,γ_]:=x^(α-1)(γ+x)^(-α-β)
A[α_,β_,γ_]=FullSimplify[Integrate[g[x,α,β,γ],{x,0,Infinity},Assumptions->α>0&&β>0&&γ>0]]
f[x_,α_,β_,γ_]:=g[x,α,β,γ]/A[α,β,γ]

meanf[α_,β_,γ_]=Integrate[x f[x,α,β,γ],{x,0,Infinity},Assumptions->α>-1&&β<-2&&γ>0]

mom2f[α_,β_,γ_]=Integrate[x^2 f[x,α,β,γ],{x,0,Infinity},Assumptions->α>-1&&β<-3&&γ>0]

var2f[α_,β_,γ_]=Integrate[(x-meanf[α,β,γ])^2 f[x,α,β,γ],{x,0,Infinity},Assumptions->α>-1&&β<-3&&γ>0]

Note : Conditional prob (Y=1| x) = 1/(1+ const r(x) )

Clear[r,check0,check1];
(* ratio of distributions *)
r[x_,{α0_,β0_,γ0_,α1_,β1_,γ1_}]:=f[x,α0,β0,γ0]/f[x,α1,β1,γ1];

(* normalization condition *)
check0[{α0_,β0_,γ0_,α1_,β1_,γ1_}]:=(α0>-1)&&(β0<-2)&&(α1>-1)&&(β1<-2)&&(γ0>0)&&(γ1>0); 

(* S curve condition *)
check1[{α0_,β0_,γ0_,α1_,β1_,γ1_}]:=(α0-α1<0)&&(β0-β1<0);

Tests

Plot[f[x,-0.5,-2,1],{x,0.001,10}]

p={1,-4,1,3,-3,2}
Print["check0=",check0[p]]
Print["check1=",check1[p]]
Print["mean0=",meanf[p[[1]],p[[2]],p[[3]]]]
Print["mean1=",meanf[p[[4]],p[[5]],p[[6]]]]
r[x,p]

Plot[f[x,p[[1]],p[[2]],p[[3]]],{x,0,10},PlotRange->All]
Plot[f[x,p[[4]],p[[5]],p[[6]]],{x,0,10},PlotRange->All]
Plot[1/(1+r[x,p]),{x,0,10},PlotRange->All]

Plot[1/(1+r[x,p]),{x,0,10},PlotRange->All]

Discussing general case of r (x)

FullSimplify[r[x,{α0,β0,γ0,α1,β1,γ1}]]