# Bay Area useR Group (R Programming Language)

Bay Area useR Group (R Programming Language) Message Board › random number from truncated pareto distribution

# random number from truncated pareto distribution

 A former member Posted 1/22/13 7:13 AM Link to discussion Post #: 1 Dear R professionals,am a newcomer to R, and greatful for any advice and help concerning the following problem:(1) I have data in a vector data\$T; each single data point I'll call data&tx(2) for these data I estimate the parameters s & beta of an pareto distribution following >http://stats.stackexc...­pareto.MLE <- function(X) { n <- length(X) m <- min(X) a <- n/sum(log(X)-log(m)) return( c(m,a) ) } par.eto.par <- c(s=pareto.MLE(data\$T)[2], beta=pareto.MLE(data\$T)[1])(3) Currently I created a loop to iterate the random draw from the total area of the Pareto distributionlibrary(VGAM) random <- rpareto(l, location=beta, shape=s) until all randomly drawn numbers (i.e. random) >= data\$txbecause this is the only line I found to draw random samples from a Pareto distribution.This loop however is inefficient and needs a lot of time to complete.(4) Hence, what I need is to restrict the area of the Pareto Distribution with parameters estimated in (2) such that the random numbers >= data\$tx .But I cannot find any possibility how to tell R to do the random draw from a somehow truncated area of the Pareto distribution.Below I give arbitrary, few values, just to provide an 'image' what I need.(a) Let say data\$T is (1;4;10;100;12000)(b) random numbers to be drawn from truncated Pareto distribution with Parameter s & beta could then look like random\$T(1;6;120;100;130023).But: there must never occur a number in random\$T that is smaller than the value in data\$T (1;4;10;100;12000) at the corresponding location.Does anyone know how to program in R a "restriction" to a distribution e.g. Pareto from where to draw random numbers?Thanks for any ideas and advice!!Cheers, LuciePS: versions/system used are R 2.15.1 running on Windows 7, 64 bit Edited by User 77,352,312 on Jan 22, 2013 8:10 AM A former member Posted 1/24/13 3:55 AM Link to reply Post #: 2 Richie Cotton (http://4dpiecharts.co...­) explained, how to solve this problem. If you need to solve the same problem (even if you use a different distribution) or if you are simply interested in the answer, you'll find his explanations at:http://stackoverflow....­Good luck!
Powered by mvnForum

### San Francisco, CA

Founded Jul 17, 2008

#### Our Sponsors

• ##### Revolution Analytics

Financial support for meetings

• ##### RStudio

Financial support for meetings

• ##### O'Reilly

Our March 29th BARUG meeting onsite at Strata Hadoop World

#### People in this Meetup are also in:

• ##### Metis: San Francisco Data Science

1,598 Data Scientists

• ##### Bay Area Women in Machine Learning & Data Science

1,842 Machine Learners

• ##### The San Francisco Ruby Meetup Group

6,042 Ruby enthusiasts

• ##### Big Data Silicon Valley

4,046 Big Daters

• ##### Data Visualization Group in the Bay Area

7,255 Data Artists

• ##### Bay Area Hackathons

3,978 Hackers

# Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy