|
Dear R users,
I hope to explain the concepts of skewness and kurtosis by generating series of distributions with same skewness and different kurtosis or with same kurtosis and different skewness, but it seems that i cannot find the right functions. I have searched the mailing list, but no answers were found. Is it possible to do that in R? Which function could be used? Thanks a lot. -- With Kind Regards, oooO::::::::: (..)::::::::: :\.(:::Oooo:: ::\_)::(..):: :::::::)./::: ::::::(_/:::: ::::::::::::: [***********************************************************************] Zhi Jie,Zhang ,PHD Tel:+86-21-54237149 Dept. of Epidemiology,School of Public Health,Fudan University Address:No. 138 Yi Xue Yuan Road,Shanghai,China Postcode:200032 Email:[hidden email] <Email%[hidden email]> Website: www.statABC.com [***********************************************************************] oooO::::::::: (..)::::::::: :\.(:::Oooo:: ::\_)::(..):: :::::::)./::: ::::::(_/:::: ::::::::::::: [[alternative HTML version deleted]] ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. |
|
Hi,
Certainly it's possible. Use any distribution function as long as you can change its skewness and kurtosis, e.g. the Chi-square distribution. The corresponding R functions are p*, q*, d*, and r* - I think you know these functions already (e.g. rchisq()). The only thing that you should be clear about is the relationship between the arguments of distribution functions in R and those in a certain theoretical distribution. Refer to http://en.wikipedia.org/wiki/Probability_distribution if you don't remember those formulae for skewness and kurtosis. Regards, Yihui -- Yihui Xie <[hidden email]> Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086 Mobile: +86-15810805877 Homepage: http://www.yihui.name School of Statistics, Room 1037, Mingde Main Building, Renmin University of China, Beijing, 100872, China On Tue, Sep 23, 2008 at 10:59 PM, zhijie zhang <[hidden email]> wrote: > Dear R users, > I hope to explain the concepts of skewness and kurtosis by generating > series of distributions with same skewness and different kurtosis or with > same kurtosis and different skewness, but it seems that i cannot find the > right functions. > I have searched the mailing list, but no answers were found. > Is it possible to do that in R? Which function could be used? > Thanks a lot. > > -- > With Kind Regards, > > oooO::::::::: > (..)::::::::: > :\.(:::Oooo:: > ::\_)::(..):: > :::::::)./::: > ::::::(_/:::: > ::::::::::::: > [***********************************************************************] > Zhi Jie,Zhang ,PHD > Tel:+86-21-54237149 > Dept. of Epidemiology,School of Public Health,Fudan University > Address:No. 138 Yi Xue Yuan Road,Shanghai,China > Postcode:200032 > Email:[hidden email] <Email%[hidden email]> > Website: www.statABC.com > [***********************************************************************] > oooO::::::::: > (..)::::::::: > :\.(:::Oooo:: > ::\_)::(..):: > :::::::)./::: > ::::::(_/:::: > ::::::::::::: > ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. |
|
In reply to this post by zhijie zhang
On Tue, Sep 23, 2008 at 9:59 AM, zhijie zhang <[hidden email]> wrote:
> Dear R users, > I hope to explain the concepts of skewness and kurtosis by generating > series of distributions with same skewness and different kurtosis or with > same kurtosis and different skewness, but it seems that i cannot find the > right functions. > I have searched the mailing list, but no answers were found. > Is it possible to do that in R? Which function could be used? > Thanks a lot. You might want to have a look at Pearson's type IV distribution. This document, http://www-cdf.fnal.gov/publications/cdf6820_pearson4.pdf, provides a pretty good introduction, and I think you can use the method of moments in reverse to fix the first four moments (~mean, sd, skewness, kurtosis) and then derive the appropriate parameters of the Pearson's distribution. Hadley -- http://had.co.nz/ ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. |
|
In reply to this post by Yihui Xie
Yihui,
Could you please show me an example? What u have refered is clear for me, but i think the thing that i donot know how to handle with is to link the relationships between skewness/kurtosis and the distributions? Thanks. On Tue, Sep 23, 2008 at 11:48 PM, Yihui Xie <[hidden email]> wrote: > Hi, > > Certainly it's possible. Use any distribution function as long as you > can change its skewness and kurtosis, e.g. the Chi-square > distribution. The corresponding R functions are p*, q*, d*, and r* - I > think you know these functions already (e.g. rchisq()). > > The only thing that you should be clear about is the relationship > between the arguments of distribution functions in R and those in a > certain theoretical distribution. Refer to > http://en.wikipedia.org/wiki/Probability_distribution if you don't > remember those formulae for skewness and kurtosis. > > Regards, > Yihui > -- > Yihui Xie <[hidden email]> > Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086 > Mobile: +86-15810805877 > Homepage: http://www.yihui.name > School of Statistics, Room 1037, Mingde Main Building, > Renmin University of China, Beijing, 100872, China > > > > On Tue, Sep 23, 2008 at 10:59 PM, zhijie zhang <[hidden email]> wrote: > > Dear R users, > > I hope to explain the concepts of skewness and kurtosis by generating > > series of distributions with same skewness and different kurtosis or > with > > same kurtosis and different skewness, but it seems that i cannot find the > > right functions. > > I have searched the mailing list, but no answers were found. > > Is it possible to do that in R? Which function could be used? > > Thanks a lot. > > > > -- > > With Kind Regards, > > > > oooO::::::::: > > (..)::::::::: > > :\.(:::Oooo:: > > ::\_)::(..):: > > :::::::)./::: > > ::::::(_/:::: > > ::::::::::::: > > [***********************************************************************] > > Zhi Jie,Zhang ,PHD > > Tel:+86-21-54237149 > > Dept. of Epidemiology,School of Public Health,Fudan University > > Address:No. 138 Yi Xue Yuan Road,Shanghai,China > > Postcode:200032 > > Email:[hidden email] <Email%[hidden email]> < > Email%[hidden email] <Email%[hidden email]>> > > Website: www.statABC.com <http://www.statabc.com/> > > [***********************************************************************] > > oooO::::::::: > > (..)::::::::: > > :\.(:::Oooo:: > > ::\_)::(..):: > > :::::::)./::: > > ::::::(_/:::: > > ::::::::::::: > > > -- With Kind Regards, oooO::::::::: (..)::::::::: :\.(:::Oooo:: ::\_)::(..):: :::::::)./::: ::::::(_/:::: ::::::::::::: [***********************************************************************] Zhi Jie,Zhang ,PHD Tel:+86-21-54237149 Dept. of Epidemiology,School of Public Health,Fudan University Address:No. 138 Yi Xue Yuan Road,Shanghai,China Postcode:200032 Email:[hidden email] <Email%[hidden email]> Website: www.statABC.com [***********************************************************************] oooO::::::::: (..)::::::::: :\.(:::Oooo:: ::\_)::(..):: :::::::)./::: ::::::(_/:::: ::::::::::::: [[alternative HTML version deleted]] ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. |
|
Well, let's take the Beta distribution for example. See
http://en.wikipedia.org/wiki/Beta_distribution for the formulae of skewness and kurtosis. We can fix the skewness at, say, 2 and let alpha = 1, then solve beta from the equation of "skewness = 2", you will get beta = 1.8164966 or 0.1835034 approximately. Then you may compute the kurtosis and find different beta values will lead to different kurtosis values (-0.7315651 and 2.139547 respectively). Is this example clear enough? Only need a little bit mathematical computation. Regards, Yihui -- Yihui Xie <[hidden email]> Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086 Mobile: +86-15810805877 Homepage: http://www.yihui.name School of Statistics, Room 1037, Mingde Main Building, Renmin University of China, Beijing, 100872, China On Wed, Sep 24, 2008 at 8:21 AM, zhijie zhang <[hidden email]> wrote: > Yihui, > Could you please show me an example? > What u have refered is clear for me, but i think the thing that i donot > know how to handle with is to link the relationships between > skewness/kurtosis and the distributions? > Thanks. > > On Tue, Sep 23, 2008 at 11:48 PM, Yihui Xie <[hidden email]> wrote: >> >> Hi, >> >> Certainly it's possible. Use any distribution function as long as you >> can change its skewness and kurtosis, e.g. the Chi-square >> distribution. The corresponding R functions are p*, q*, d*, and r* - I >> think you know these functions already (e.g. rchisq()). >> >> The only thing that you should be clear about is the relationship >> between the arguments of distribution functions in R and those in a >> certain theoretical distribution. Refer to >> http://en.wikipedia.org/wiki/Probability_distribution if you don't >> remember those formulae for skewness and kurtosis. >> >> Regards, >> Yihui >> -- >> Yihui Xie <[hidden email]> >> Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086 >> Mobile: +86-15810805877 >> Homepage: http://www.yihui.name >> School of Statistics, Room 1037, Mingde Main Building, >> Renmin University of China, Beijing, 100872, China >> >> >> >> On Tue, Sep 23, 2008 at 10:59 PM, zhijie zhang <[hidden email]> wrote: >> > Dear R users, >> > I hope to explain the concepts of skewness and kurtosis by generating >> > series of distributions with same skewness and different kurtosis or >> > with >> > same kurtosis and different skewness, but it seems that i cannot find >> > the >> > right functions. >> > I have searched the mailing list, but no answers were found. >> > Is it possible to do that in R? Which function could be used? >> > Thanks a lot. >> > >> > -- >> > With Kind Regards, >> > >> > oooO::::::::: >> > (..)::::::::: >> > :\.(:::Oooo:: >> > ::\_)::(..):: >> > :::::::)./::: >> > ::::::(_/:::: >> > ::::::::::::: >> > >> > [***********************************************************************] >> > Zhi Jie,Zhang ,PHD >> > Tel:+86-21-54237149 >> > Dept. of Epidemiology,School of Public Health,Fudan University >> > Address:No. 138 Yi Xue Yuan Road,Shanghai,China >> > Postcode:200032 >> > Email:[hidden email] <Email%[hidden email]> >> > Website: www.statABC.com >> > >> > [***********************************************************************] >> > oooO::::::::: >> > (..)::::::::: >> > :\.(:::Oooo:: >> > ::\_)::(..):: >> > :::::::)./::: >> > ::::::(_/:::: >> > ::::::::::::: >> > > > > > -- > With Kind Regards, > > oooO::::::::: > (..)::::::::: > :\.(:::Oooo:: > ::\_)::(..):: > :::::::)./::: > ::::::(_/:::: > ::::::::::::: > [***********************************************************************] > Zhi Jie,Zhang ,PHD > Tel:+86-21-54237149 > Dept. of Epidemiology,School of Public Health,Fudan University > Address:No. 138 Yi Xue Yuan Road,Shanghai,China > Postcode:200032 > Email:[hidden email] > Website: www.statABC.com > [***********************************************************************] > oooO::::::::: > (..)::::::::: > :\.(:::Oooo:: > ::\_)::(..):: > :::::::)./::: > ::::::(_/:::: > ::::::::::::: > ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. |
|
In reply to this post by zhijie zhang
Check out JohnsonFit in SuppDists.
On Tue, Sep 23, 2008 at 10:59 AM, zhijie zhang <[hidden email]> wrote: > Dear R users, > I hope to explain the concepts of skewness and kurtosis by generating > series of distributions with same skewness and different kurtosis or with > same kurtosis and different skewness, but it seems that i cannot find the > right functions. > I have searched the mailing list, but no answers were found. > Is it possible to do that in R? Which function could be used? > Thanks a lot. > > -- > With Kind Regards, > > oooO::::::::: > (..)::::::::: > :\.(:::Oooo:: > ::\_)::(..):: > :::::::)./::: > ::::::(_/:::: > ::::::::::::: > [***********************************************************************] > Zhi Jie,Zhang ,PHD > Tel:+86-21-54237149 > Dept. of Epidemiology,School of Public Health,Fudan University > Address:No. 138 Yi Xue Yuan Road,Shanghai,China > Postcode:200032 > Email:[hidden email] <Email%[hidden email]> > Website: www.statABC.com > [***********************************************************************] > oooO::::::::: > (..)::::::::: > :\.(:::Oooo:: > ::\_)::(..):: > :::::::)./::: > ::::::(_/:::: > ::::::::::::: > > [[alternative HTML version deleted]] > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. |
|
And here is one way of using JohnsonFit to display how a distribution changes with changes in the moments:
library(TeachingDemos) library(SuppDists) tmpfun <- function(m1=0,m2=1,m3=-0.2,m4=3.7, xmin=-3, xmax=3){ parms <- JohnsonFit( c(m1,m2,m3,m4), 'use') plot(function(x) dJohnson(x,parms), xmin, xmax) } tmplst <- list( Parameters=list( m1=list('slider', init=0, from=-1, to=1, resolution=0.1), m2=list('slider', init=1, from=0 , to=3, resolution=0.1), m3=list('slider', init=-0.2, from=-1, to=1, resolution=0.1), m4=list('slider', init=3.7, from=0 , to=10, resolution=0.5)), xmin=list('numentry', init=-3, width=5), xmax=list('numentry', init=3 , width=5) ) tkexamp( tmpfun, tmplst, plotloc='left' ) of course assuming that you have SuppDists and TeachingDemos packages installed, play around with this (and possibly change parameters and/or limits in tmplst) before demoing it as there are many combinations of the parameters that cause errors. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [hidden email] 801.408.8111 > -----Original Message----- > From: [hidden email] [mailto:r-help-bounces@r- > project.org] On Behalf Of Gabor Grothendieck > Sent: Wednesday, September 24, 2008 6:29 AM > To: zhijie zhang > Cc: [hidden email] > Subject: Re: [R] Generating series of distributions with the same > skewness and different kurtosis or with same kurtosis and different > skewness? > > Check out JohnsonFit in SuppDists. > > On Tue, Sep 23, 2008 at 10:59 AM, zhijie zhang <[hidden email]> > wrote: > > Dear R users, > > I hope to explain the concepts of skewness and kurtosis by > generating > > series of distributions with same skewness and different kurtosis or > with > > same kurtosis and different skewness, but it seems that i cannot find > the > > right functions. > > I have searched the mailing list, but no answers were found. > > Is it possible to do that in R? Which function could be used? > > Thanks a lot. > > > > -- > > With Kind Regards, > > > > oooO::::::::: > > (..)::::::::: > > :\.(:::Oooo:: > > ::\_)::(..):: > > :::::::)./::: > > ::::::(_/:::: > > ::::::::::::: > > > [********************************************************************** > *] > > Zhi Jie,Zhang ,PHD > > Tel:+86-21-54237149 > > Dept. of Epidemiology,School of Public Health,Fudan University > > Address:No. 138 Yi Xue Yuan Road,Shanghai,China > > Postcode:200032 > > Email:[hidden email] <Email%[hidden email]> > > Website: www.statABC.com > > > [********************************************************************** > *] > > oooO::::::::: > > (..)::::::::: > > :\.(:::Oooo:: > > ::\_)::(..):: > > :::::::)./::: > > ::::::(_/:::: > > ::::::::::::: > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > [hidden email] mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide http://www.R-project.org/posting- > guide.html > > and provide commented, minimal, self-contained, reproducible code. > > > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting- > guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. |
| Powered by Nabble | Edit this page |
