distribution function #2

  • Permalink
  • submit to reddit
  • Email
  • Follow


Hi,

i'm a beginner in matlab.I need to create distribution function of a meixner distribution:
function y=meixner(x,a,b,d,m)
x=x(:);
n=length(x);
for k=1:n
y(k)=(2*cos(b/2))^(2*d)*exp(b*(x(k)'-m)./a)*abs(gamma(d+i*(x(k)-m)./a)).^2/(2*a*pi*gamma(2*d));
y=y(:);
end

and i don't know how.
could someone please help me?
thanks a lot
0
Reply Yoggi (4) 3/14/2010 1:18:02 PM

See related articles to this posting


"jeny hu" <Yoggi@post.sk> wrote in message <hninma$k1$1@fred.mathworks.com>...

If you don't know how, what does the code you posted do?
0
Reply mattjacREMOVE (3194) 3/14/2010 1:25:05 PM

"Matt J " <mattjacREMOVE@THISieee.spam> wrote in message <hnio3h$6bt$1@fred.mathworks.com>...
> "jeny hu" <Yoggi@post.sk> wrote in message <hninma$k1$1@fred.mathworks.com>...
> 
> If you don't know how, what does the code you posted do?

the code creates a probability density function and i need to create a distribution function
0
Reply Yoggi (4) 3/14/2010 1:32:05 PM

"jeny hu" <Yoggi@post.sk> wrote in message <hniogl$c6p$1@fred.mathworks.com>...

> the code creates a probability density function and i need to create a distribution function
===============

help cumsum
0
Reply mattjacREMOVE (3194) 3/14/2010 1:35:23 PM

"Matt J " <mattjacREMOVE@THISieee.spam> wrote in message <hniomr$eu4$1@fred.mathworks.com>...
> "jeny hu" <Yoggi@post.sk> wrote in message <hniogl$c6p$1@fred.mathworks.com>...
> 
> > the code creates a probability density function and i need to create a distribution function
> ===============
> 
> help cumsum
I need the cdf for statistical testing(kstest,kuiper test....) and i know the result(accept H0) and I've already tried cumsum but this ends with rejecting H0
0
Reply Yoggi (4) 3/14/2010 1:48:02 PM

"jeny hu" <Yoggi@post.sk> wrote in message <hnipei$pn5$1@fred.mathworks.com>...

> > help cumsum
> I need the cdf for statistical testing(kstest,kuiper test....) and i know the result(accept H0) and I've already tried cumsum but this ends with rejecting H0
==============

That doesn't mean cumsum is wrong. It could mean there's aproblem somewhere else.
0
Reply mattjacREMOVE (3194) 3/14/2010 2:34:05 PM

jeny hu wrote:
> "Matt J " <mattjacREMOVE@THISieee.spam> wrote in message 
> <hniomr$eu4$1@fred.mathworks.com>...
>> "jeny hu" <Yoggi@post.sk> wrote in message 
>> <hniogl$c6p$1@fred.mathworks.com>...
>>
>> > the code creates a probability density function and i need to create 
>> a distribution function
>> ===============
>>
>> help cumsum
> I need the cdf for statistical testing(kstest,kuiper test....) and i 
> know the result(accept H0) and I've already tried cumsum but this ends 
> with rejecting H0

Your original code was:

function y=meixner(x,a,b,d,m)
x=x(:);
n=length(x);
for k=1:n
y(k)=(2*cos(b/2))^(2*d)*exp(b*(x(k)'-m)./a)*abs(gamma(d+i*(x(k)-m)./a)).^2/(2*a*pi*gamma(2*d));
y=y(:);
end


There is no H0 anywhere in there, so cumsum() applied to the output of 
this function is not going to have any problem with H0.

What you do with the distribution function after you have it is a 
different matter. Be sure you are asking us the right question.
0
Reply roberson (2979) 3/14/2010 5:08:35 PM

On 3/14/2010 9:18 AM, jeny hu wrote:

> i'm a beginner in matlab.I need to create distribution function of a
> meixner distribution:

This is a continuous distribution, correct?  And presumably there is no closed form for the distribution?  So you might consider using (for example) QUADGK to numerically integrate your PDF.  CUMSUM probably isn't what you want, unless you are using it as a poor-man's numerical integration.

But you have a bit of a problem here:   this line

> y(k)=(2*cos(b/2))^(2*d)*exp(b*(x(k)'-m)./a)*abs(gamma(d+i*(x(k)-m)./a)).^2/(2*a*pi*gamma(2*d));

calls the gamma function with a complex argument, and as the help says,

>> help gamma
  GAMMA Gamma function.
     Y = GAMMA(X) evaluates the gamma function for each element of X.
     X must be real.

So you will have to find something other than GAMMA.  The MATLAB File Exchange has what seems like a well-written version (also the very first google hit for "complex gamma matlab):

<http://www.mathworks.com/matlabcentral/fileexchange/978>

Other than that, there's no reason to loop over elements in computing the PDF, you can do it with one vectorized statement.
0
Reply Peter.Perkins (345) 3/15/2010 1:45:08 PM

Peter Perkins <Peter.Perkins@MathRemoveThisWorks.com> wrote in message <hnldl4$s0f$1@fred.mathworks.com>...
> On 3/14/2010 9:18 AM, jeny hu wrote:
> 
> > i'm a beginner in matlab.I need to create distribution function of a
> > meixner distribution:
> 
> This is a continuous distribution, correct?  And presumably there is no closed form for the distribution?  So you might consider using (for example) QUADGK to numerically integrate your PDF.  CUMSUM probably isn't what you want, unless you are using it as a poor-man's numerical integration.
> 
> But you have a bit of a problem here:   this line
> 
> > y(k)=(2*cos(b/2))^(2*d)*exp(b*(x(k)'-m)./a)*abs(gamma(d+i*(x(k)-m)./a)).^2/(2*a*pi*gamma(2*d));
> 
> calls the gamma function with a complex argument, and as the help says,
> 
> >> help gamma
>   GAMMA Gamma function.
>      Y = GAMMA(X) evaluates the gamma function for each element of X.
>      X must be real.
> 
> So you will have to find something other than GAMMA.  The MATLAB File Exchange has what seems like a well-written version (also the very first google hit for "complex gamma matlab):
> 
> <http://www.mathworks.com/matlabcentral/fileexchange/978>
> 
> Other than that, there's no reason to loop over elements in computing the PDF, you can do it with one vectorized statement.


I use in that code gamma function for complex numbers,but still i have problem with the CDF
0
Reply Yoggi (4) 3/15/2010 3:50:27 PM
comp.soft-sys.matlab 203514 articles. 531 followers. Post

8 Replies
91 Views

Similar Articles

[PageSpeed] 47


  • Permalink
  • submit to reddit
  • Email
  • Follow


Reply:

Similar Artilces:

What's the unit for bi-directional reflectance distribution function? Is it solid angle because BDRF = Radiance / Irradiance = [W/(m^2 * sr^2)] / [W/m^2] = sr^2 thx a lot;)
What's the unit for bi-directional reflectance distribution function? Is it solid angle because BDRF = Radiance / Irradiance = [W/(m^2 * sr^2)] / [W/m^2] = sr^2 thx a lot;) kevin...@gmail.com wrote: > What's the unit for bi-directional reflectance distribution function? > Is it solid angle because BDRF = Radiance / Irradiance = > [W/(m^2 * sr^2)] / [W/m^2] = sr^2 > > thx a lot;) Hi Kevin, The unit is inverse-steradian, sr^-1 or 1/sr, because BRDF = Radiance / Irradiance = [W * m^-2 * sr^-1] / [W * m^-2] = [sr^-1]. Or, if you prefer, BRDF ...

COVARIANCE IN MULTIVARIATE NORMAL DISTRIBUTION FUNCTION #2
I have calculated a covariance of a set of 13-dimension vectors. Now when i have passed this matrix as a parameter into the mvnpdf it is giving an error message that 'covariance must be a positive-definite matrix. Can you suggest me how to create a mvnpdf for a given 13-dimensional vectors. On 12/15/2010 7:11 AM, tarun wrote: > I have calculated a covariance of a set of 13-dimension vectors. Now > when i have passed this matrix as a parameter into the mvnpdf it is > giving an error message that 'covariance must be a positive-definite > matrix. > > Can yo...

Problem with the Sum Function -- Using a Benford Distribution #2
(* define a PDF*) f = Log[10, 1 + 1/d] (* compute for various values of the parameter *) Table[Apply[Plus, Table[f, {d, 10 ^ h, 10 ^ (h + 1) - 1}]], {h, 0, 4}]// N (* the mean is well defined *) Table[ Apply[Plus, Table[d Log[10, 1 + 1/d], {d, 10^h, 10^(h + 1) - 1}]] //N, {h, 0, 4}] (* here is a parametric formula for the mean *) mean =Assuming[k \[Element] Integers && k � 0, Sum[d Log[10, 1 + 1/d], {d, 10^k, 10^(k + 1) - 1}]] // FullSimplify (* the formula appears to be wrong *) Table[N[mean], {k, 0, 4}] ...

"pointlabel"-like function for Python: distribute text labels on a 2-d scatter plot to avoid overlapping labels
Hello. There is a function for R (http://bm2.genes.nig.ac.jp/RGM2/ R_current/library/maptools/man/pointLabel.html) to help with placing/ locating text labels in an optimized way so as to minimise some measure of text overlap (or likely text overlap). Has anyone written or ported such a thing for Python? Thanks, c > measure of text overlap (or likely text overlap). =A0Has anyone written > or ported such a thing for Python? Hm (talking to myself)... the link I gave above has some references, and one of those includes some python code. Seems not packaged up yet for plots,...

function 2 function
Hi friends .. Is it possible to set the parameters in a function with a different function..? I need that to change the membership function parameters of a fuzzy block in a function from another function..? If you can help please a sample to erguzel2000@yahoo.com thanks ...

22.2.2.2.2 Facet locale and function put
If I use facet num_put that belongs to the Polish locale to put a number with the str parameter localized to the English locale, I get an English form of a number. What is the motivation making this facet belong to a locale if the locale it belongs to has no influence on how it works? Chris Relevant code snippet produces the output 100,000: std::wcout.imbue(std::locale("English")); *std::use_facet<std::num_put<wchar_t> >(std::locale("Polish")) ..put(std::wcout, std::wcout, L' ', 100000L) = L'\n'; --- [ comp.std.c++ is mo...

Using function with 2 outputs as input to function requiring 2 inputs
I have been using a line similar to: V = complex(pol2cart(theta, r)); but have discovered that it is giving me a real output regardless of the values of theta and r. Apparently only the first output of pol2cart is passed to complex. Is it possible to do this without having to create temporary variables such as: [Re, Im] = pol2cart(theta, r); V = complex(Re, Im); Thanks, Kyle ...

Apache 2.2 lost some SSL functionality from 2.0?
I want to move my systems from CentOS4 to 5 and am currently checking out the differences going from Apache 2.0 to 2.2. Basically I don't find much and can reuse most of my configuration. But I found a showstopper issue with the SSL module. It cannot identify name-based virtual hosts anymore. I see there is an FAQ at http://httpd.apache.org/docs/2.2/ssl/ssl_faq.html#vhosts2 and I see this FAQ is available for 2.0 as well. Just that it is wrong at least for 2.0. This *was* possible with Apache 2.0 and I don't see that change listed in the Upgrade 2.2 guide. In case you ...

Inverse function #2 #2
I have two questions: 1. Is it possible to find the inveses function for one-to-one function in Mathematica 7? For example the inverse of 5/(2-x) is 2-(5/x). I have tried Inverse and InverseFunction but I cannot produce the inverse function. Can anyone explain how to get Mathematica to produce this result? (See attached output screenshot.) 2. Is it possible to change the format of the output for a recprical? For example, instead of writing the output of Inverse[5/(2-x)] as (5/(2-x))^-1, can the output be set to produce (2-x)/5? Clear[f]; f[x_] = 5/(2 - x); Attri...

Level-2 M-File S-Function like Level 2 C-MEX Functions ssGetTStart and ssGetSampleTime
There are function for "Level-2 M-File S-Function" like the "Level-2 C-Mex S-Functions" ssGetTStart and ssGetSampleTime? Thanks for your help! Martin Bartl ssGetTStart <--> get_param(model_name, 'StartTime') ssGetSampleTime <--> block.SampleTime, where block is the runtime object that is available inside a level-2 M-file S-Function. "Martin Bartl" <MartinBartl@gmx.de> wrote in message news:oh27rss55xm7@legacy... > There are function for "Level-2 M-File S-Function" like the "Level-2 > C-Mex S-Functions" ssG...

Function definition into main() function. #2
Hello, Does the code below obey the ISO/IEC 9899:1999 Standard? #include <stdio.h> #include <stdlib.h> int main(void) { int a = 10; void print() { printf("a = %d\n\n", a); } print(); return 0; } Thanks in advance, Vinicius. CViniciusM wrote: > Hello, > > Does the code below obey the ISO/IEC 9899:1999 Standard? > > #include <stdio.h> > #include <stdlib.h> > > int main(void) > { > int a = 10; > > void print() > { > printf("a = %d\n\n", a); > } &g...

function name from function pointer #2
hi, is it possible to get function name from function pointer. I am using gcc compiler on linux. thanks sinbad wrote: > hi, > is it possible to get function name from function pointer. I am using > gcc compiler > on linux. > Yes, but not in standard C. Try a Linux group, or comp.unix.programmer. -- Ian Collins On 11 Nov 2008 at 6:15, sinbad wrote: > is it possible to get function name from function pointer. I am using > gcc compiler on linux. Yes: man dladdr. You'll probably need to give gcc the -rdynamic flag to get the linker to export a full symbol table. ...

calling a function within a function #2
hi, can u call a function within a function.. for example in function y =rkw(someFunc,x) y = someFunc(x) I type in rkw(x^2,2) in matllab and it says tha x is undefined.. i know there is some simple syntax or something that i need to get this to work but iv been trying forever and i cant get aynthing to work... any help would be GREATLY appreciated rkw(@(x) x.^2, 2) Try also help topics Anonymous Functions str2func Kirill mark wrote: > hi, can u call a function within a function.. for example in > > function y =rkw(someFunc,x) > > y = someFunc(x) > > I type in rkw(x^...

Function definition into main() function. #2
Hello, Does the code below obey the ISO/IEC 9899:1999 Standard? #include <stdio.h> #include <stdlib.h> int main(void) { int a = 10; void print() { printf("a = %d\n\n", a); } print(); return 0; } Thanks in advance, Vinicius. In message <73464201.0402271004.22a56326@posting.google.com>, CViniciusM <cviniciusm@uol.com.br> writes >Hello, > >Does the code below obey the ISO/IEC 9899:1999 Standard? No, you can declare but not define a function at block scope (the declaration is as if it ha...

class-call a function in a function -problem #2
Hello, i have a problem. I write my first class in python so i'm not a experience user. I want to call a function in another function, i tried to do it in many ways, but i always failed:( I supposed it's sth very simple but i can't figure what it is: ================================== class ludzik: x=1 y=2 l=0 def l(self): ludzik.l=ludzik.x+ludzik.y print ludzik.l def ala(self): print ludzik.x print ludzik.y ludzik.l() z=ludzik() z.ala() ==================================== k.py 1 2 Traceback (most recent call last): File "k.py", line 17, in ? z...

Transfer function (tf) with sqrt function. #2
Hi! I have an analytic function f=sqrt(1+s) And i want to turn it to the transfer function by the next code: s=tf('s') sys=sqrt(1+s) But Matlab says: Undefined function or method 'sqrt' for input arguments of type 'tf' Could somebody help me with this issue? What should I do to overcome it? Thanks! "Aleks Dyskin" <aleks.dyskin@gmail.com> wrote in message <he14qa$5fm$1@fred.mathworks.com>... > Hi! > I have an analytic function f=sqrt(1+s) > And i want to turn it to the transfer function by the next code: > s=tf('s'...

Re: functionality of the in(xxx:xxx) function #2
I am thinking that an overloaded format would work. Proc format ; Value MyFMT 1 - 5000 = "20 , LA1" 5001 - 10000 = "21 , LA2" 10001 - 15000 = "22 , LA3" 15001 - 20000 = "23 , LA4" 20001 - 25000 = "24 , LA5" 25001 - 30000 = "25 , LA6" ; run ; data cms.drop1criteriafinal ; set cms.drop1criteriaexport ; mailid = input( Scan( Put( _N_ , MyFMt. ) , 1 , ',' ) , 8. ) ; lettertextid = Scam( Put( _N_ , MyFMt. ) , 2 , ',' ) ; run ; Toby Dunn From: "Choate, Paul@DDS" <...

How about the distribution of a*(x^2)+(1-a)*(y^2)
Hi, I have a question about random variable distribution. Please help me if you could. We know x and y are independent normal random variables. "a" is a constant between 0 and 1. We want to know the distribution of a*(x^2)+(1-a)*(y^2). From probability text books, it is easy to know that the sum of two independant normal RVs'(They, RVs, have the same mean and variance) square is chi-square distribution. For my question, they are weighted with "a" and "1-a". I have no answer. Anyone can tell me? Thanks in advance. <freelait2000@yahoo.com> wrote in me...

how to pass an abstract function as a function argument? #2
hi everybody, this is my first post here, I hope you can help me! ^_^ let consider for example: syms x y param f = x+y+param; I want to create a function that, for instance, takes as arguments the function f and a vector of numbers and gives back the result of f - how can I do that? res = functionname(f,1,2,3) doesn't work as when in the function I try to print f it gives me f=0.. please help me! ...

Re: is there any function in SAS 8.2, #2
Hi, Paul Dorfman posted one a while back for counting words prior to v9- couldn't find it in the archives. I think it was something like this %macro countW(string) ; length(&string)-length(compress(&string))+1 %mend countW ; data _null_ ; x="count the number of words in this string" ; y=%countW(x) ; put _all_ ; run ; 2009/6/24 Shaik Hymad <hymadsk@gmail.com>: > Hi all, > > is there any function in SAS 8.2, which counts number of words or > specified charecters in a string.. > > bye > hymad > ...

getting dead locks with 2 functions #2
This is a multi-part message in MIME format. ------=_NextPart_000_000D_01C47B13.75B5A490 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit I have the following 2 functions and I'm getting deadlocks when I call them from multiple threads. The first, I'm not sure why because I'm doing a select for update. The second I'm doing an insert on, and I thought insert will automatically do a lock as it inserts: -------------FUNCTION 1: ------------- CREATE OR REPLACE FUNCTION public.select_pend_visitation_for_unvis...

PHP 5.2.1: cli does load php_mysql.dll while the same script executed by apache 2.2 fails Call to undefined function mysql_connect()
Hi there! After I overcame some short_open_tag (thanks, Rik!) I encounter another strange php-behaviour. The script I just got to work on the windows-commandline obviously does as php.ini tells php to do and loads php_mysql.dll: E:\ersDHCP>php ./extractLog.php .... some mysql-stuff, some output, OK The same script invoked by the webserver apache 2.2 entails an error: http://localhost/extractLog.php PHP Fatal error: Call to undefined function mysql_connect() My configuration php.ini does contain the line extension=php_mysql.dll and seems to be OK while I use the script from commandline....

I have normalized my data between 0-2 as one of my input features has values between 0-2. so what activation function should i use to get output in range 0-2? Any suggestions?
I have input feature that can have 0,1 or 2 values. That is why i normalize= d all other data in range 0-2. Now should it is necessary to apply activati= on function on output neuron? if it is, then what activation function i sho= uld apply or how to apply to get output between range 0-2? On Wed, 4 Jun 2014 04:29:46 -0700 (PDT), Aamir Nawaz <engr.aamir09@gmail.com> wrote: >I have input feature that can have 0,1 or 2 values. That is why i normalized all other data in range 0-2. Now should it is necessary to apply activation function on output neuron? if it is, then what activa...

fitting a bimodal distribution with a 2 Poisson model? #2
Hello, I have a 2 dimensional vector of numbers in matlab. One dimension contains values (the y-axis) and the second dimension contains the indexes of the values (the x-axis). This is all after manipulating the data. By plotting the y-data against the x-data I get a bimodal distribution to whom I want to fit a 2 Poisson model. Does anyone have an idea on how to do this? ...