similar to: Random numbers from skewed distributions

Displaying 20 results from an estimated 10000 matches similar to: "Random numbers from skewed distributions"

2007 Apr 12
3
Random Sequence
Dear Friends, I'm trying to generate a sequence of 100 observations with either a 1 or -1. In other words the sequence should look something like this. y = 1 1 -1 1 -1 -1 -1 1 1 ...... Can somebody please give me some direction on how I can do this in R. Thanks Anup ____________________________________________________________________________________ Don't get soaked. Take a
2007 Apr 23
0
New version of actuar
UseRs, actuar is a package for Actuarial Science. A rather preliminary version (0.1-3) of the package has been available on CRAN since February 2006. We now announce the immediate availability of version 0.9-2 sporting a large number of new features. Non actuaries behold! There can be some features of interest for you, especially those related to new probability distribution and to the
2007 Apr 23
0
New version of actuar
UseRs, actuar is a package for Actuarial Science. A rather preliminary version (0.1-3) of the package has been available on CRAN since February 2006. We now announce the immediate availability of version 0.9-2 sporting a large number of new features. Non actuaries behold! There can be some features of interest for you, especially those related to new probability distribution and to the
2007 Feb 25
3
Random Integers
Hi all, Is there an R function to generate random integers? Thanks in advance. Sincerely Anup --------------------------------- Now that's room service! Choose from over 150,000 hotels [[alternative HTML version deleted]]
2008 Mar 14
1
Rejection sampling to draw from distributions
Dear friends, Please find below the code that I have employed for a rejection sampler to draw from asymmetric laplace distributions. I was wondering if this code can be written more efficiently? Are there more efficient ways of drawing random numbers from asymmetric laplace distributions?? Thanks in advance for your help and have a great weekend. Regards Anup
2007 Apr 18
2
Data Manipulation using R
Dear Friends, I have data set with around 220,000 rows and 17 columns. One of the columns is an id variable which is grouped from 1000 through 9000. I need to perform the following operations. 1) Remove all the observations with id's between 6000 and 6999 I tried using this method. remdat1 <- subset(data, ID<6000) remdat2 <- subset(data, ID>=7000) donedat <- rbind(remdat1,
2007 Jul 06
1
row index
Dear Friends, Suppose I have a vector as follows RI Value 1 10 2 11 3 8 4 4 6 12 I would like a function which returns the"row index number" for the minimum value of VALUE. Can somebody please give me some direction on how I can do this. In effect I'm trying to find a comparable function for the GAUSS command "minindc" >From the GAUSS Manual
2007 Jul 24
1
Passing equations as arguments
Friends, I'm trying to pass an equation as an argument to a function. The idea is as follows. Let us say i write an independent function Ideal Situation: ifunc <- function(x) { return((x*x)-2) } mainfunc <- function(a,b) { evala <- ifunc(a) evalb <- ifunc(b) if (evala>evalb){return(evala)} else return(evalb) } Now I want to try and write this entire program in a single
2007 Sep 08
1
Problem with the aggregate command
Dear friends, I have a data set with 23 columns and 38000 rows. It is a panel running from the years 1991 through 2005. I want to aggregate the data and get the medians of each of the 23 columns for each of the years. In other words my output should be like this Year Median 1991 123 1992 145 1993 132 etc. The sample lines of code to do this operation is set1 <-
2010 Jan 12
1
Strange behavior when trying to piggyback off of "fitdistr"
Hello. I am not certain even how to search the archives for this particular question, so if there is an obvious answer, please smack me with a large halibut and send me to the URLs. I have been experimenting with fitting curves by using both maximum likelihood and maximum spacing estimation techniques. Originally, I have been writing distribution-specific functions in 'R' which work
2007 Aug 19
1
Creating a data set within a function
Dear Friends, I'm trying to find if there is a way to automate creation of the design matrix. Suppose we are interested in say running an autoregressive model. The user inputs the following data myfunAR <- function(y, order) {..... ...... } now here y is the data series and order represents the level of the process. In other words if order=2 then we have an AR (2) process. Now it is easy
2007 Jun 04
1
Help with conditional lagging of data
Dear Friends, I have some data with three columns named ID, Year and Measure X. I need to create a column which gives me a lag for each ID (note not a continous lag), but a lag conditional on the id and the given year. Please find below a sample of the data Input file sample ID Year X AB12 2000 100 AB12 2001 120 AB12 2002 140 AB12 2003 80 BL14 2000 180 BL14
2007 Aug 21
1
Random Sampling from a Matrix
Dear Friends, I have a matrix of size 5000 X 20. The first two columns are indicator variables taking the value of either 0 or 1. Let us call the first two columns Y1 and Y2. I need to randomly sample 1000 rows with all the associated columns, in other words my new matrix should be of size 1000 X 20. I realize that using this command newmat <- mainmat[sample(1000,replace=F),] achieves
2010 Dec 07
1
Help on loops
Dear R-helpers, I have a basic question on using loops. I have a panel data set with different variables measured for "n" firms over "t" time periods. A snapshot of the data is given below id    t    X1    X2 1    1     4    3 1    2    9    2 1    3    7    3 1    4    6    6 2    1    6    4 2    2    5    3 2    3    1    1 3    1    9    6 3    2    5    5 thus total
2007 Feb 28
3
matrix manipulations
Dear friends, I have a basic question with R. I'm generating a set of random variables and then combining them using the cbind statement. The code for that is given below. for (i in 1:100) { y <- rpois(i,lambda=10) X0 <- seq(1,1,length=i) X1 <- rnorm(i,mean=5,sd=10) X2 <- rnorm(i,mean=17,sd=12) X3 <- rnorm(i,mean=3, sd=24) ind <- rep(1:5,20) }
2010 Dec 09
1
Constraints when sampling from a distribution
 Dear R-helpers, My question is related to how to impose constraints when when sampling from a distribution. For example, suppose I'm sampling a vector from a multivariate normal distribution vbeta <- 100*diag(2) mbeta <- c(1,1) ans <- beta <- c(rmvnorm(1,mbeta,vbeta)) ans will thus be a vector with two elements. My question is how do I place a restriction on one of the
2013 Jul 14
2
creating dummy variables based on conditions
Hello everyone, I have a dataset which includes the first three variables from the demo data below (year, id and var). I need to create the new variable ans as follows If var=1, then for each year (where var=1), i need to create a new dummy ans which takes the value of 1 for all corresponding id's where an instance of one was recorded. Sample data with the output is shown below. year
2009 Mar 23
0
Parameter Estimation - "3 Paramter Gamma distribution"
Der r helpers, I have a following set of data. Though some other software, I know it follows 3 parameter Gamma distrinution. I need to write a R code for estimating the parameters of 3 Parameter Gamma distribution. c(0,0,18561.9,0,0,0,34400,0,0,0,0,2190,0,0,0,0,60000,0,0,0, ? 19583,0,0,0,109872.87,0,0,0,0,0,0,1244,0,0,25150,0,500,0,0,0, ?
2009 Jun 10
2
Creating a specific skewed distribution
All, Can someone help me create a skewed distribution, mean = 30, with probability of selecting a random number from the distribution greater than or equal 60 equal to 10%? I need the probability density function to equal zero at zero, and have a maximum height at or near 30. Is this possible? And if it is possible, how can I adjust the distribution so that the probability of selecting a
2020 Oct 24
0
Fitting Mixed Distributions in the fitdistrplus package
Dear Charles, Please, when you have questions about fitdistrplus, contact directly the authors of the package and not R-help. When fitting non ? standard ? distributions with fitdistrplus, you should define by yourself the density and the cumulative distribution functions, or load a package which define them. See FAQ for a general example :