Skip to main content
edited tags
Link
added 23 characters in body
Source Link
flyingmind
  • 609
  • 3
  • 10

I'm rather new to Mathematica having been a longtime Matlab user, so apologies if my question is framed incorrectly or I have missed out expected infomation. I have tried to distill the problem to the essentials.

Effectively I am trying to plot a a transformed distribution in a similar fashion to this example code:

    data = RandomVariate[NormalDistribution[6, 5/3], 10^6];
    Show[Histogram[data, Automatic, "PDF"], 
    Plot[PDF[NormalDistribution[6, 5/3], x], {x, 0, 14}, 
    PlotStyle -> Thick]]

I have create a transformed distribution, sampled some data from it using RandomVariate and plotted it in a histogram.

    hiod = 6.5/2;
    transDistrib = 
    TransformedDistribution[hiod/Tan[theta*Degree], 
    theta \[Distributed] NormalDistribution[6, 5/3]];
    dataTrans = RandomVariate[transDistrib, 10^6];
    Histogram[dataTrans, {0, 80, 1}, "PDF", ImageSize -> Large ]

This works as expected (I have done the same thing in Matlab). However, the equivalent generation of a PDF fails (code just hangs and aborts).

    Plot[PDF[transDistrib, x], {x, 0, 80}, PlotStyle -> Thick]

I get the distinct feeling I an making a terribly simple error, either in my basic coding or understanding of how to represent probability distributions in Mathematica.

Ultimately I would like to derive the equation for the transformed distribution, but I have stumbled at this earlier stage using Mathematicas inbuilt functions.

Any pointers to solving my error would be greatly appreciated. I'm using Mathematica 11.0.1 on macOSX Sierra.

I'm rather new to Mathematica having been a longtime Matlab user, so apologies if my question is framed incorrectly or I have missed out expected infomation. I have tried to distill the problem to the essentials.

Effectively I am trying to plot a a transformed distribution in a similar fashion to this example code:

    data = RandomVariate[NormalDistribution[6, 5/3], 10^6];
    Show[Histogram[data, Automatic, "PDF"], 
    Plot[PDF[NormalDistribution[6, 5/3], x], {x, 0, 14}, 
    PlotStyle -> Thick]]

I have create a transformed distribution, sampled some data from it using RandomVariate and plotted it in a histogram.

    transDistrib = 
    TransformedDistribution[hiod/Tan[theta*Degree], 
    theta \[Distributed] NormalDistribution[6, 5/3]];
    dataTrans = RandomVariate[transDistrib, 10^6];
    Histogram[dataTrans, {0, 80, 1}, "PDF", ImageSize -> Large ]

This works as expected (I have done the same thing in Matlab). However, the equivalent generation of a PDF fails (code just hangs and aborts).

    Plot[PDF[transDistrib, x], {x, 0, 80}, PlotStyle -> Thick]

I get the distinct feeling I an making a terribly simple error, either in my basic coding or understanding of how to represent probability distributions in Mathematica.

Ultimately I would like to derive the equation for the transformed distribution, but I have stumbled at this earlier stage using Mathematicas inbuilt functions.

Any pointers to solving my error would be greatly appreciated. I'm using Mathematica 11.0.1 on macOSX Sierra.

I'm rather new to Mathematica having been a longtime Matlab user, so apologies if my question is framed incorrectly or I have missed out expected infomation. I have tried to distill the problem to the essentials.

Effectively I am trying to plot a a transformed distribution in a similar fashion to this example code:

    data = RandomVariate[NormalDistribution[6, 5/3], 10^6];
    Show[Histogram[data, Automatic, "PDF"], 
    Plot[PDF[NormalDistribution[6, 5/3], x], {x, 0, 14}, 
    PlotStyle -> Thick]]

I have create a transformed distribution, sampled some data from it using RandomVariate and plotted it in a histogram.

    hiod = 6.5/2;
    transDistrib = 
    TransformedDistribution[hiod/Tan[theta*Degree], 
    theta \[Distributed] NormalDistribution[6, 5/3]];
    dataTrans = RandomVariate[transDistrib, 10^6];
    Histogram[dataTrans, {0, 80, 1}, "PDF", ImageSize -> Large ]

This works as expected (I have done the same thing in Matlab). However, the equivalent generation of a PDF fails (code just hangs and aborts).

    Plot[PDF[transDistrib, x], {x, 0, 80}, PlotStyle -> Thick]

I get the distinct feeling I an making a terribly simple error, either in my basic coding or understanding of how to represent probability distributions in Mathematica.

Ultimately I would like to derive the equation for the transformed distribution, but I have stumbled at this earlier stage using Mathematicas inbuilt functions.

Any pointers to solving my error would be greatly appreciated. I'm using Mathematica 11.0.1 on macOSX Sierra.

Source Link
flyingmind
  • 609
  • 3
  • 10

Plotting a transformed distribution as a PDF

I'm rather new to Mathematica having been a longtime Matlab user, so apologies if my question is framed incorrectly or I have missed out expected infomation. I have tried to distill the problem to the essentials.

Effectively I am trying to plot a a transformed distribution in a similar fashion to this example code:

    data = RandomVariate[NormalDistribution[6, 5/3], 10^6];
    Show[Histogram[data, Automatic, "PDF"], 
    Plot[PDF[NormalDistribution[6, 5/3], x], {x, 0, 14}, 
    PlotStyle -> Thick]]

I have create a transformed distribution, sampled some data from it using RandomVariate and plotted it in a histogram.

    transDistrib = 
    TransformedDistribution[hiod/Tan[theta*Degree], 
    theta \[Distributed] NormalDistribution[6, 5/3]];
    dataTrans = RandomVariate[transDistrib, 10^6];
    Histogram[dataTrans, {0, 80, 1}, "PDF", ImageSize -> Large ]

This works as expected (I have done the same thing in Matlab). However, the equivalent generation of a PDF fails (code just hangs and aborts).

    Plot[PDF[transDistrib, x], {x, 0, 80}, PlotStyle -> Thick]

I get the distinct feeling I an making a terribly simple error, either in my basic coding or understanding of how to represent probability distributions in Mathematica.

Ultimately I would like to derive the equation for the transformed distribution, but I have stumbled at this earlier stage using Mathematicas inbuilt functions.

Any pointers to solving my error would be greatly appreciated. I'm using Mathematica 11.0.1 on macOSX Sierra.