TransWikia.com

Normalize an L(s, d) function for fixed s

Mathematica Asked on May 4, 2021

I have the following function L:

σ = 9;
L[s_, d_] = (1/(σ*Sqrt[2*[Pi]]))*E^(-(1/2)*((s-(-50-11*Log[d]))/σ)^2)

This function L describes basically for some specific d, the distribution of the random variable s. Therefore, for some fixed d value, the L[s] has the properties of a PDF. What I would like to do is find another function R[s_, d_] that does the opposite. That means, that for a fixed s value, the R[d] is the normalization version (normalized between [dmin, dmax]) of the corresponding L[d].

Any idea if this is even possible? Thank you for your time

2 Answers

σ = 9;
L[s_, d_] = (1/(σ*Sqrt[2*π]))*
   E^(-(1/2)*((s - (-50 - 11*Log[d]))/σ)^2);

The probability distribution is

dist[s_] = 
  ProbabilityDistribution[L[s, d], {d, 0, Infinity}, 
   Method -> "Normalize"];

r[s, d] is the PDF of the distribution

r[s_, d_] = PDF[dist[s], d]

enter image description here

Verifying the normalization,

Integrate[r[s, d], {d, 0, Infinity}]

(* 1 *)

The mean of the distribution is

Mean[dist[s]]

(* E^(-(857/242) - s/11) *)

The variance of the distribution is

Variance[dist[s]]

(* (-1 + E^(81/121)) E^(-(857/121) - (2 s)/11) *)

To generate random data from the distribution for a particular value of s:

SeedRandom[1234];

data = RandomVariate[dist[1], 200];

Show[
 Histogram[data, Automatic, "PDF"],
 Plot[r[1, d], {d, 0, 0.12}]]

enter image description here

Correct answer by Bob Hanlon on May 4, 2021

If the $d$ takes on values from 0 to $infty$, then the normalizing constant is given by

Integrate[L[s, d], {d, 0, ∞}]
(* 1/11 E^(-(1019/242) - s/11) *)

So you could define the following function which is non-negative and integrates to 1 for a pdf associated with $d$:

r[s_, d_] := L[s, d]/(1/11 E^(-(1019/242) - s/11))

You should avoid using capital letters for functions you define.

Answered by JimB on May 4, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP