Items tagged with statistics statistics Tagged Items Feed

Hi friends! I have a problem with Random Variable. I don't understand why theoretical Mean differs from sample's Mean

restart; with(Statistics);

r := RandomVariable(NegativeBinomial(3, .1));


S := Sample(r, 10000);

d := map(unapply((3-1)/(3+t-1), t), S);



But !!

For example if p=0.2 then all is well




  I think similar question has been asked by several people, but I did not find a suitable thread. My question is, suppose I have a probablity distirubtion function like

  p(x,y) = exp(-alpha (x+y) ) x^2 y^2 / |x-y|  , alpha>0

 x,y goes from - \infty to + \infty. This function is normalizable but unbounded, which makes the rejection algorithm a bit difficult(?).


  How to generate samping points from this type of probability distribution function?


Thank you very much!



I'm null in statistic. I'm doing a calculation to calculate a set of parameter. By example:

I have to calculate 5 parameters x1,x2,x3,x4,x5 from 7 equations f1,f2,f3,f4,f5,f6,f7. Because it is difficult to calculate directly 5 parameters, I used chisquare to minimize the difference between experimental and theorical data. Then, I can get the results. After that, I used these 5 parameters to back-calculate the data using 7 equations above. My question is about how to calculate the error bar (or standard error) of the back-calculate datato add to the plot.

Thank you  for helping me,

Best regards.


I tried to fit a sin function to some data using Statistics[Fit] however the result either didn't work properly or worked differently from the way I expected it to work.

a2 is the calculated function from Statistics[Fit] and a3 is some quickly inserted values that provides a more satisfying result. 

Why is a better fitting line not found?

restart; gc()

X := [73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91]:

Y := [35, 35, 36, 41, 47, 42, 43, 37, 34, 28, 28, 30, 27, 33, 35, 38, 42, 42, 40]:




a1 := pointplot(zip(`[]`, X, Y)):

f := Statistics:-Fit(a*sin(b*x+c)+d, X, Y, x)



a2 := plot(f, x = 72 .. 92):


display(a1, a2)


f1 := 8*sin(.5*x-5.5)+36



a3 := plot(f1, x = 72 .. 92):


plots:-display(a1, a3)




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.



 I am using a very basic function in Statistics package as below and get error. 

X := RandomVariable(Normal(a, b));

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.


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