# Items tagged with statisticsstatistics Tagged Items Feed

### Endless computation for a sample from a created di...

June 23 2015
1 5

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:

(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);
DensityPlot(T);
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 show which circle do the row of data belong...

May 30 2015
0 0

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

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

### cumulative sum of a vector...

April 10 2015
0 3

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

s:=Statistics[CumulativeSum](prices[1..251,1])

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?

### compute the cdf of a piecewise probability distrib...

April 01 2015
1 1

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

### Do loop problem...

March 16 2015
0 1

Hello

I am trying to do a do loop

X[1] := Statistics:-Sample(Binomial(200, .5), 1);

for i to 10 do X[i+1] := Statistics:-Sample(Binomial(200-X[i], .5), 1) end do;

And it shows error like this

Error, (in rtable/Sum) invalid arguments.

Did I do something wrong in my code?

### binomial data simulation...

March 09 2015
0 1

How to simulate a data which is follow by binomial distribution, n=200, p=0.9.

I know normal can be simulated by following code

random[normald[0, 1]](50)

### Fit a Graph with 3 points...

February 19 2015
0 3

I'm wondering why the fit routine gives weird results, when telling him to fit

with(Statistics):

X:=Vector[column](3, {1 = 616.3096, 2 = 616.3248, 3 = 616.3342}, datatype = sfloat, storage = rectangular, order = Fortran_order, shape = []);

Y:=Vector[column](3, {1 = 99590., 2 = 127564., 3 = 144223.}, datatype = sfloat, storage = rectangular, order = Fortran_order, shape = []);

g:=Fit(a+b*x+c*x^2,X,Y,x)

It's telling me: Warning, model is not of full rank

If I calculate the coefficients the direct way (well the fit should be exact,because we only have 3 values and 3 parameters) I get:

M:=Matrix(3, 3, {(1, 1) = 1, (1, 2) = 616.3096, (1, 3) = 379837.52305216, (2, 1) = 1, (2, 2) = 616.3248, (2, 3) = 379856.25909504, (3, 1) = 1, (3, 2) = 616.3342, (3, 3) = 379867.84608964}, datatype = anything, storage = rectangular, order = Fortran_order, shape = []);
V:=Vector[column](3, {1 = 99590, 2 = 127564, 3 = 144223}, datatype = anything, storage = rectangular, order = Fortran_order, shape = []);
with(LinearAlgebra):
C:=MatrixVectorMultiply(M^-1,V)

### Expected Value of a function...

January 08 2015
0 2

Hello people in Mapleprimes,

I want to do calculations about an expected value.

For example,

expectedvalueofc.pdf

that is, \int_a^b c d \Omega

where, \Omega is a distribution function of c.

But, I don't know whether this equation can be put into worksheet.

Is there no way other than writing this as

\int_a^b c g(c) dc,

where g shows a probability density function.

Can I use Statistics[ExpectedValue] to calculate expected value with a general distribution function, not specified

to normal distribution?

I hope you will give me some hints.

Best wishes.

### Why doesn't the integral evaluate?...

November 29 2014
0 4

I want to integrate the following cumulative distribution function with variable bounds but maple returns the integral.

>with(Statistics);

>N := RandomVariable(Normal(0, 1)):

>a := (ln(98.53*(1/95))+(0.1e-1+.5*x^2)*.5)/(x*sqrt(.5))

>y:= CDF(N, a, inert = true);

How do i make maple return a function of x instead of an integral?

### Histogram defaults...

September 20 2014
2 1

Statistics:-Histogram by default choses the vertical axis such that the area under the histogram is 1 (or something like that). In my work, I invariably need to add "frequencyscale=absolute" to get the scale I need. Is there any way to make this the default? Typing this every time gets so old... I have been looking to something analogous to plots:-setoptions but that doesn't seem to exist for Statistics.

M.D.

### How do I calculate run of symbols in a binary word...

September 16 2014
2 3

How do I calculate run of 0s or run of 1s using maple?

### Generalized Least Squares...

August 30 2014
1 4

Hi Everyone

Is there a built-in way to fit a regression using generalized least squares in Maple ?

### How to compile statistics each number in a sequenc...

August 23 2014
1 16

RandomCompositions:= proc(n::posint, k::posint)
local
C,
Compositions:= [seq(C-~1, C= combinat:-composition(n+k, k))],
Rand:= rand(1..nops(Compositions))
;
()-> Compositions[Rand()]
end proc:

R:= RandomCompositions(9,6):
n:= 2^13:
S:= 'R()' $n: I want to compile statistics each number in a sequence cannot occur over twice. The sequences that do not fit the rule above must be ommitted. The statistic is Fermi-Dirac statistics. confused the Bose-Einstein condensation and Fermi-Dirac statistics. But the theory is right. ### How to animate the DensityPlot of a RandomVariable... August 23 2014 2 7 Hi, I don't manage to animate a DensityPlot. Here is my program : > restart; > with(Statistics): with(plots): > P := lambda->RandomVariable(Poisson(lambda)): > animate(DensityPlot,[P(n),range=0..10],n=1..5,frames=5); And here is the error message : Plotting error, non-numeric vertex definition Thanks for any help ### How to count the same random sequence as one... August 21 2014 0 6 RandomCompositions:= proc(n::posint, k::posint) local C, Compositions:= [seq(C-~1, C= combinat:-composition(n+k, k))], Rand:= rand(1..nops(Compositions)) ; ()-> Compositions[Rand()] end proc: R:= RandomCompositions(9,6): n:= 10: S:= 'R()'$ n;

S := [4, 1, 1, 1, 2, 0], [3, 2, 1, 1, 0, 2], [0, 1, 1, 0, 0, 7], [0, 1, 1, 5, 0, 2], [1, 0, 3, 1, 3, 1],

[1, 3, 1, 1, 0, 3], [1, 4, 2, 0, 2, 0], [5, 0, 0, 3, 1, 0], [1, 1, 1, 4, 0, 2], [0, 1, 2, 1, 0, 5]

[4, 1, 1, 1, 2, 0] , [1, 1, 1, 4, 0, 2]  and [0, 1, 1, 5, 0, 2] , [0, 1, 2, 1, 0, 5]  are same number

but different order.

There are two same sequence. I want to  count  as one, and compile statistics the summation, and

divide by 8.

the result

0=14/8

1=17/8

2=6/8

...

4=2/8

5=2/8

...

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