# Items tagged with statisticsstatistics Tagged Items Feed

### Problem with a certain distribution...

18 hours ago
1 7

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));
Mean((3-1)/(3+r-1));

0.1000000000

S := Sample(r, 10000);

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

Mean(d);

0.04703520901756091

But !!

For example if p=0.2 then all is well

### Generate multivariate distribution ...

January 01 2016
0 3

Hi,

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!

### How to calculate error of calculation?...

December 18 2015
1 0

Hi,

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.

### Fit data to sine function off...

December 17 2015
1 23

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.

 (1)

 (2)

### Style of errorbars in ErrorPlot...

November 26 2015
1 0

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.

### Moments of Function...

November 06 2015
1 9

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)

### Multiple DensityPlot in one figure...

October 20 2015
0 2

Hi,

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.

### Error in Distribution...

October 17 2015
0 2

Hi,

I have the following input

***

restart;
with( Statistics ):

a:=2;c:=0.3;
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 );
print(norm_factor);

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

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

print(cc,S[1]);

***

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 );

i.e.

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

### Code Generation for R...

September 11 2015
1
0

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: https://www.youtube.com/watch?v=0Mn1W2j56aA

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 “FunctionTable.mm” 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.

### ScatterPlot with Regression Line...

September 10 2015
1 2

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 graph.project1.mwproject1.mw

Thanks much.

Matt

### Statistics, RandomVariable error...

September 10 2015
0 5

Hi,

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

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

### How to plot two vectors of data?...

August 15 2015
3 6

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.

### Fit of coefficients ...

August 11 2015
0 15

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?

### creation of random matrices...

July 28 2015
1 21

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 ?

### Fit based on Excel data...

July 13 2015
1 8

Hello

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

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

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.

Hasselhof

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