Items tagged with statistics statistics Tagged Items Feed

Hello everybody,


I would like to know if there's a possibility to change the style of the errorbars in errorplot. I would espacially like to add short lines at both ends of each errorbar, orthogonal to those, similiar to the looks of errorbars in GNUplot.


I appreciate your help. Many thanks in advance!

Hello Please,


I was wondering if the moments(mean, variance,...) of this function bellow exists even if in approximate form.


f(x) = binomial(x+r-1, x)*((1/2)*b/(1+d*x+(1/2)*b))^r*((d*x+1)/(1+d*x+(1/2)*b))^x/(d*x+1)


Somebody, please help.



I want to plot two density functions of norm(1,1) and norm(4,1) in one figure.

But it appears the function DensityPlot can only plot one at a time.



  I have the following input



with( Statistics ):

g:= exp(-a*x) + c*a*exp(-a*x);
#f := x -> piecewise( x < 0, 0, x>0, g );
 f :=x -> piecewise( x < 0, 0, x>0, exp(-a*x) + c*a*exp(-a*x));

norm_factor:=int( f(x), x=0..infinity );

F := Distribution( PDF = 1/norm_factor*f ):
X := RandomVariable( F ):

N := 20;
S := convert( Sample(X,N), list );




The code works. However, if I comment out 

 f :=x -> piecewise( x < 0, 0, x>0, exp(-a*x) + c*a*exp(-a*x));

 , then use

f := x -> piecewise( x < 0, 0, x>0, g );



f := x -> piecewise( x < 0, 0, x>0, g );
 #f :=x -> piecewise( x < 0, 0, x>0, exp(-a*x) + c*a*exp(-a*x));


It is said "

Error, (in Statistics:-Sample) unable to construct the envelopes for _R, try to specify the initial range"


The norm_factors are actually the same for both inputs. What is the reason for the error message?  Suppose I still want to use something like

f := x -> piecewise( x < 0, 0, x>0, g );

,how to fix the problem?


Thank you very much



Maple’s Code Generation makes it possible to translate your Maple code to various other programming languages including C, Python, and several others. In Maple 2015, we added a new Code Generation target to one of my other personal favourite languages, R. R is a programming language designed for statistical computing and graphics, so no code translation from Maple to R would be complete without attempting to translate as many commands as possible from Maple’s Statistics package. 

Translating code from one language to another is tricky business. Maple 2015 represented the first time that any Code Generation target language added the ability to translate commands from the Statistics package. With R, we found that many common statistics commands had almost a one-to-one mapping, such as Statistics:-Mean = mean, but several others were much more complicated, including several commands for dealing with probability functions that did not have direct mappings due to differences in how the systems handle symbolic probability functions.

A list of statistics commands that can be translated from Maple to R can be found here.

In addition to assisting me recall the correct syntax in R, having worked with CodeGeneration[R] for several months now, I find that one of my most common uses for Maple’s code generation to R is simply to pass data between the systems. A simple example:

 CodeGeneration:-R( LinearAlgebra:-RandomMatrix( 5, 2 ) );

translates to the following in R:

 cg <- matrix(c(-4,27,8,69,99,29,44,92,-31,67),nrow=5,ncol=2)

To see a couple more short examples, here’s a short video that I recorded on Code Generation to R:


A little known fact about Code Generation is that the translation files can be viewed in from the “samples” directory in your Maple install directory. Similar to many of Maple’s packages, you can view all of the source code that Code Generation uses for its translations. For example, you can view the translations for the commands that I mentioned above from the “” file inside of your “%MapleInstallDir%/ samples/CodeGeneration/R” directory.

Should you have any feedback on this translation, or any other, please feel free to contact us. We’re also on the hunt for our next code generation targets, so let us know what other languages you would like to see added as Code Generation targets.

I imported data into maple from excel.  I was able to make a scatterplot with my data and a regression line, but I have been unsuccessful in trying to combine them both onto the same plot.  I tried multiple different ways but still could not get it to work.  

I think it has to do something with the brackets around each element inside my imported array, but I am not sure.  Any ideas would be nice.

My objective is to put the regression line and scatterplot on same  

Thanks much.


Hoe do you plot two vectors of data as a bar plot or historygram. I tried the statistics package but could not plot a bar plot that shows the proper relation of numbers in vector x to numbers in relation to vector y. Vector x contained years as data, and vector y contained for example crime data per year.

I have some excel data which I need to fit in the formula:

0.5a*erfc(0.5*2^0.5*(-x+m1/s1)) + (0.5-0.5a)*erfc(0.5*2^0.5*(-x+m2/s2))

In this formula the coefficient m ans s are mean and standard deviation and a is the weigth of 2 peak in a cummulative gaussian distribution.

I fitted this (I will insert the maple file) and found:

-48736.43 erfc(-0.707x + 0.707) + 48736.43 erfc(0.707x + 0.707)

Can this be correct?

And how do I find the values of m1, s1, m2, s2 and a?


I'd want to create numerical vectors or matrices such that each entry follow the same normal law $N(a,b)$ (the entries are independent). How to do ?

Thanks in advance.


I am working on a project where I need to find the parameters of the formula:


which is the formula for the cumulative distribution for two gaussian peaks, one with average m1 and standard deviation s1, the other m2 and s2, with weights a and (1-a). I have data in excel that form the gaussian distribution but now I need to find the parameters of the formula that fits these data.

Is there a command in maple to find these parameters or how do I start? And do I need to upload the data from excel to maple or do I need to insert only some values?

Some one who could help me, because it is really hard and I find no information for this.


I am trying to find the pdf of the inverse of a random variable X, that represents a distribution I defined. I currently have : 

T:=Distribution(PDF=(x->piecewise(0<x and x<1,1/4,3<x and x<5,3/8,0)));

but this seems to be incorrect as I get a message saying T1:=RandomVariable(Y) is being passed a wrong argument. 

What is the right way to obtain the pdf of 1/X?


Hi all,


I want to create a (set of) samples from an own distribution. The distribution itself is a normal distribution, but with some 'gaps', as shown below:

plot(exp(-(t-10)^2/(2*(0.5e-1*10)^2))*piecewise(t<9,0,t<9.9,1, t<10.1,0, t<11,1), t = 8.5 .. 11.5)

(It is supposed to represent the distribution of discrete resistor values (e.g. 10 ohms), where not only the values above the tolerance (e.g. 10%) are removed, but also those who can be sold as higher precision resistors (eg. 1%). The mean, lower tolerance and higher tolerance should be variables).

Because of the fact that in order to be able to use the Sample function, the PDF should be twice differentiable, the 'truncation' in the middle is realised using logistic functions.

I am able to create said distribution, and produce a DensityPlot, but when I try to take a (even a single) Sample from a RandomVariable from that distribution, Maple keeps calculating and no sample is produced.

GetDist := (mu, alpha, beta) -> Distribution(PDF = unapply(LotRPDF(t, mu, alpha, beta), t)):
T := GetDist(10, .1, 0.1e-1);
RandomR := RandomVariable(T):
Sample(RandomR, 1);

Where LotRPDF is the function depicted above, mu is the mean (10), alpha is the maximum tolerance (10%), , beta is the minimum tolerance (1%)

Am i overlooking something simple? Or is there a more fundamental error in my approach? I've added the maple sheet with more details.



how to call matlab to run k means on the data and

how to show which circle do the row of data belong to?

I have a (251*1) vector for which I need to compute the cumulative sum. I'm currently using :


defined under the Statistics package but this method doesn't return an output, even though the argument passed is a vector.

Is there another method I can use?

This should be trivial but I am not able to figure out the right syntax to execute it

The pdf is given by :

f_X(x)={ 1/25 *x, 0<=x<5

             2/5 -x/25, 5<=x<10

             0, otherwise

I have tried to use the "CumulativeDistributiveFunction" so far

1 2 3 4 5 6 7 Last Page 1 of 10