search for: rlnorm

Displaying 20 results from an estimated 121 matches for "rlnorm".

2005 Jan 07
3
lognorm
Hi! I 've a problem to have a lognorm distribution with mean=1 and var (or sigma)=1. rlnorm(1000,0,0) rlnorm(1000,1,1) rlnorm(1000,0,1) .... ? Can you help me?
2008 May 04
1
Is my understanding of rlnorm correct?
rlnorm takes two 'shaping' parameters: meanlog and sdlog. meanlog would appear from the documentation to be the log of the mean. eg if the desired mean is 1 then meanlog=0. So to generate random values that fit a lognormal distribution I would do this: rlnorm(N , meanlog = log(mean) , sdlog...
2013 May 10
1
rlnorm(n, meanlog = 0, sdlog = 1)
Hi list, Does anyone know the code behind rlnorm(n, meanlog = 0, sdlog = 1)? I am going to write it in c#. thanks Alireza [[alternative HTML version deleted]]
2012 Sep 01
2
help on setting boundaries for generating random numbers
Dear All,   is there a way to set low and high limits to a simulation with rlnorm()?   as an example:  a <-rlnorm(500,0.7,1)     I get the summary of   Min. 1st Qu. Median Mean 3rd Qu. Max. 0.1175 1.0590 2.1270 3.4870 4.0260 45.3800 I would like to set limits so that the simulated values minimum would be greater then 0.5 and maximum of less than 30. If durin...
2004 May 01
2
Generating Lognormal Random variables (PR#6843)
Full_Name: Anthony Gichangi Version: 1.90 OS: Windows XP Pro Submission from: (NULL) (130.225.131.206) The function rlnorm generates negative values for lognormal distribution. x- rlnorm(1000, meanlog = 0.6931472, sdlog = 1) Regards Anthony
2010 Jun 21
2
How to predict the mean and variance of the dependent variable after regression
Hi, folks, As seen in the following codes: x1=rlnorm(10) x2=rlnorm(10,mean=2) y=rlnorm(10,mean=10)### Fake dataset linmod=lm(log(y)~log(x1)+log(x2)) After the regression, I would like to know the mean of y. Since log(y) is normal and y is lognormal, I need to know the mean and variance of log(y) first. I tried mean (y) and mean(linmod), but either...
2009 May 20
1
sem with categorical data
...cmaster.ca/jfox/Misc/sem/SEM-paper.pdf. When I apply the hetcor function, I receive the following error: Error in checkmvArgs(lower = lower, upper = upper, mean = mean, corr = corr, : at least one element of 'lower' is larger than 'upper' Example: set.seed(781) q1 <- cut2(x = rlnorm(n = 1e2, m = 2), cuts = seq(1,6)) q2 <- cut2(x = rlnorm(n = 1e2, m = 0), cuts = seq(1,6)) q3 <- cut2(x = rlnorm(n = 1e2, m = 1), cuts = seq(1,6)) dat <- data.frame(q1,q2,q3) hetcor(data = dat, ML = T, pd = T, use = 'p') Any help in understanding and correcting the error would be a...
2008 Feb 20
3
reshaping data frame
...I tried with reshape{stats} and melt{reshape} but I was missing something. Any help is very welcome. Please find details below: ################################# # data in its original shape: indiv <- rep(c("A","B"),c(10,10)) level.1 <- rpois(20, lambda=3) covar.1 <- rlnorm(20, 3, 1) level.2 <- rpois(20, lambda=3) covar.2 <- rlnorm(20, 3, 1) my.dat <- data.frame(indiv,level.1,covar.1,level.2,covar.2) # the values of level.1 and level.2 represent the number of cases for the particular # combination of indiv*level*covar value # I would like to do two things:...
2012 Oct 14
0
multivariate lognormal distribution simulation in compositions
Dear All,   thanks to Berend, my question posted yesturday was solved succesfully here: http://r.789695.n4.nabble.com/hep-on-arithmetic-covariance-conversion-to-log-covariance-td4646068.html . I posted the question with the assumption of using the results with rlnorm.rplus() from compositions. Unfortunatelly, I am not getting reasonable enough outcome. Am I applying the results wrongfully? The example: I have known means and cov matrix of a multivariate distribution as follows:   sigma <-matrix(c(0.0037,-0.0001,-0.0370,-0.0136,0.0026,-0.0001,0.0001,0.0008,-0...
2005 Jun 29
2
MLE with optim
Hello, I tried to fit a lognormal distribution by using optim. But sadly the output seems to be incorrect. Who can tell me where the "bug" is? test = rlnorm(100,5,3) logL = function(parm, x,...) -sum(log(dlnorm(x,parm,...))) start = list(meanlog=5, sdlog=3) optim(start,logL,x=test)$par Carsten. [[alternative HTML version deleted]]
2009 Feb 11
3
Generating Numbers With Certain Distribution in R
Dear all, Is there a way to generate K numbers of integer (K = 10^6). The maximum value of the integer is 200,000 and minimum is 1. And the occurrences of this integer follows a lognormal distribution. - Gundala Viswanath Jakarta - Indonesia
2012 Oct 11
2
Help on probability distribution question
...th a normal distribution but in the "log-domain" to avoid from negative values to be generated. Since the expected mean  and SD is usually known from the normal domain, using the methods described in the wikipedia article "Arithmetric moments" I generate μand σ and simulate with rlnorm(). At times though the following issue comes up: I have the mean and SD for the parameters available from the normal domain, and the covariance matrix from the normal domain. Then I would like to simulate the values, but to avoid from negative values being generated I have to fall back on rlnorm in...
2009 Jul 20
3
Histograms on a log scale
...http://tolstoy.newcastle.edu.au/R/help/05/09/12044.html https://stat.ethz.ch/pipermail/r-help/2002-June/022295.html http://www.harding.edu/fmccown/R/#histograms Now, consider the code snippet taken from http://www.harding.edu/fmccown/R/#histograms # Get a random log-normal distribution r <- rlnorm(1000) # Get the distribution without plotting it using tighter breaks h <- hist(r, plot=F, breaks=c(seq(0,max(r)+1, .1))) # Plot the distribution using log scale on both axes, and use # blue points plot(h$counts, log="xy", pch=20, col="blue", main="Log-normal distr...
2012 May 16
3
finding mean and SD for a log-normal distribution
...d best describe it when resimulated using log normal distribution. Currently I am using another software to estimate the respective mean and SD on the log scale and the results are: 1.6667 and SD 0.47071. Then, to best reproduce my original distribution in R, I use the following commands:   c <- rlnorm(5000,1.6667,0.47071) d <- exp(c) mean(c) sd(c)   and the results for mean and SD are 5.92 and 2.94 (original 6 and 3), respectively, which I am reasonably happy with. I would like to grow independent of the another software I use, but am unable to figure out how to generate the values of 1.6667...
2010 Jul 13
1
Batch file export
Dear all, I have a code that generates data vectors within R. For example assume: z <- rlnorm(1000, meanlog = 0, sdlog = 1) Every time a vector has been generated I would like to export it into a csv file. So my idea is something as follows: for (i in 1:100) { z <- rlnorm(1000, meanlog = 0, sdlog = 1) write.csv(z, "c:/z_i.csv") Where "z_i.csv" is a filename that is...
2012 Apr 20
1
Ternaryplot as an inset graph
...this particular function. It overlays the old plot rather than plotting as an inset. Here is a simple version of what I'm trying. Note that if I change the inset plot to be an ordinary scatter, for instance, it works as expected. library(ade4) library(vcd) tdat <- data.frame(x=runif(20), y=rlnorm(20), z=rlnorm(20)) insetPlot <- function(data){ ternaryplot(data) } ternaryplot(tdat) add.scatter(insetPlot(tdat), posi="topleft", ratio=.2) Thanks very much, Jennifer Young Fisheries and Oceans Canada Jennifer.Young@dfo-mpo.gc.ca [[alternative HTML version deleted]]
2009 May 31
1
Bug in truncgof package?
...ncgof CRAN package, found something that looked like a bug, and did my job: contacted the maintainer. But he did not reply, so I am resending my query here. I installed package truncgof and run the example for function ad.test. I got the following output: set.seed(123) treshold <- 10 xc <- rlnorm(100, 2, 2) # complete sample xt <- xc[xc >= treshold] # left truncated sample ad.test(xt, "plnorm", list(meanlog = 2, sdlog = 2), H = 10) Supremum Class Anderson-Darling Test data: xt AD = 3.124, p-value = 0.12 alternative hypothesis: two.sided treshold = 10, simulatio...
2013 Mar 18
2
Fit a mixture of lognormal and normal distributions
Hello I am trying to find an automated way of fitting a mixture of normal and log-normal distributions to data which is clearly bimodal. Here's a simulated example: x.1<-rnorm(6000, 2.4, 0.6)x.2<-rlnorm(10000, 1.3,0.1)X<-c(x.1, x.2) hist(X,100,freq=FALSE, ylim=c(0,1.5))lines(density(x.1), lty=2, lwd=2)lines(density(x.2), lty=2, lwd=2)lines(density(X), lty=4) Currently i am using mixtools and just run: library(mixtools)mixmdl = normalmixEM(X, k=2, epsilon = 1e-08, maxit = 1000, maxrestarts=20,...
2012 Oct 30
6
standard error for quantile
Dear all I have a question about quantiles standard error, partly practical partly theoretical. I know that x<-rlnorm(100000, log(200), log(2)) quantile(x, c(.10,.5,.99)) computes quantiles but I would like to know if there is any function to find standard error (or any dispersion measure) of these estimated values. And here is a theoretical one. I feel that when I compute median from given set of values it will...
2008 Feb 02
2
Confidence Interval
I have a model as follows: x <- replicate(100, sum(rlnorm(rpois(1,5), 0,1))) y <- quantile(x, 0.99)) How would one go about estimating the boundaries of a 95% confidence interval for y? Any pointers would be greatly appreciated. > version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major 2 minor 5.1 year 2007 month...