Displaying 14 results from an estimated 14 matches for "rtnorm".
Did you mean:
rnorm
2006 Aug 16
3
fitting truncated normal distribution
Hello,
I am a new user of R and found the function dtnorm() in the package msm.
My problem now is, that it is not possible for me to get the mean and sd out of a sample when I want a left-truncated normal distribution starting at "0".
fitdistr(x,dtnorm, start=list(mean=0, sd=1))
returns the error message
"Fehler in "[<-"(`*tmp*`, x >= lower & x <= upper,
2008 Jul 23
2
truncated normal
Hi, I want to generate random samples from truncated normal say
Normal(0,1)Indicator((0,1),(2,4)). It has more than one intervals. In the
library msm, it seems to me that the 'lower' and 'upper' arguments can only
be a number. I tried rtnorm(1,mean=0,sd=1, lower=c(0,2),upper=c(1,4)) and it
didn't work. Can you tell me how I can do truncated normal at more than one
intervals?
Thank you.
[[alternative HTML version deleted]]
2011 Oct 24
3
Create a matrix with increment and element with zero subscript
Hello,
Does anyone knows how to deal with zero subscript in R. I have this code:
for (i in 1:nitems){
+ for (j in 1:ncat-1) {
+ draw<-matrix(rnorm(nitems*(ncat-1),seed1,seed2),nitems,(ncat-1))
+ d<-( sigma_d*draw ) + mu_d
+ draw<-matrix(rtnorm((nitems*(ncat-1)),mean = seed1, sd = seed2, lower = .1, upper = 1.5),nitems,(ncat-1))
+ d<-(sigma_d*draw) + mu_d
+ write.matrix(cbind(b.i0,d), file = "F:/KU/MIRT group/MIMIC-DIF/R/cpprcode/b0d.dat", sep = " ")
+ b[i,j]<-b[i,j-1]+d[i,j]
+...
2006 Jun 10
3
sparse matrix, rnorm, malloc
Hi,
I'm Sorry for any cross-posting. I've reviewed the archives and could
not find an exact answer to my question below.
I'm trying to generate very large sparse matrices (< 1% non-zero
entries per row). I have a sparse matrix function below which works
well until the row/col count exceeds 10,000. This is being run on a
machine with 32G memory:
sparse_matrix <-
2010 Jul 27
1
R CMD build wiped my computer
...E=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m64 -mtune=generic -c rbv.cc -o rbv.o
gcc -m64 -std=gnu99 -I/usr/include/R -I/usr/local/include -fpic
-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c
rtnorm.c -o rtnorm.o
g++ -m64 -I/usr/include/R -I/usr/local/include -fpic -O2 -g -pipe
-Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m64 -mtune=generic -c rtnormR.cc -o rtnormR.o
g++ -m64 -shared -L/usr/local/lib64 -o MCMCglmm.so MCMCglmm.o cs_add.o
cs_...
2010 Jul 27
1
R CMD build wiped my computer
...E=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m64 -mtune=generic -c rbv.cc -o rbv.o
gcc -m64 -std=gnu99 -I/usr/include/R -I/usr/local/include -fpic
-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c
rtnorm.c -o rtnorm.o
g++ -m64 -I/usr/include/R -I/usr/local/include -fpic -O2 -g -pipe
-Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m64 -mtune=generic -c rtnormR.cc -o rtnormR.o
g++ -m64 -shared -L/usr/local/lib64 -o MCMCglmm.so MCMCglmm.o cs_add.o
cs_...
2010 Jul 27
1
R CMD build wiped my computer
...IFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m64 -mtune=generic -c rbv.cc -o rbv.o
gcc -m64 -std=gnu99 -I/usr/include/R -I/usr/local/include -fpic
-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c
rtnorm.c -o rtnorm.o
g++ -m64 -I/usr/include/R -I/usr/local/include -fpic -O2 -g -pipe
-Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m64 -mtune=generic -c rtnormR.cc -o rtnormR.o
g++ -m64 -shared -L/usr/local/lib64 -o MCMCglmm.so MCMCglmm.o cs_add.o
cs_addR.o...
2006 Aug 18
0
Fitting Truncated Lognormal to a truncated data set (was: fitting truncated normal distribution)
...()
if (length(n) > 1)
n <- length(n)
while (length(ret) < n) {
y <- rlnorm(n - length(ret), mean, sd)
y <- y[y >= lower & y <= upper]
ret <- c(ret, y)
}
stopifnot(length(ret) == n)
ret
}
# This is modified off the code for 'rtnorm' of the library(msm).
rtlnorm <- function (n, mean = 0, sd = 1, lower = -Inf, upper = Inf)
{
ret <- numeric()
if (length(n) > 1)
n <- length(n)
while (length(ret) < n) {
y <- rlnorm(n - length(ret), mean, sd)
y <- y[y >= lower & y <=...
2007 Dec 14
1
Truncated normal distribution
I am using TNORM - rtnorm to simulate from a truncated normal distribution.
However, the current function available allows us to define the mean and SD
of the non-truncated (original) distribution and then run the simulation.
http://rss.acs.unt.edu/Rdoc/library/msm/html/tnorm.html
I would instead like to define the mean a...
2002 May 09
2
truncated normal
Does anyone know of an R-function that will generate an observation from a
truncated normal (left or right) with a mu and sigma2? Any correspondence
would be greatly appreciated.
Best regards, Scott Summerill
FAA ACB-330
SIGNAL Corp.
609-485-6377
scott.ctr.summerill at tc.faa.gov
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read
2016 Aug 19
2
can't build from source: error: template with C linkage
Hi All,
Users have contacted me because they can not build MCMCglmm from source. All are using R 3.3.0 on various machines with different compilers
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.2) 5.4.0
g++ (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4
Mac OS X El Capitan (version/compiler unspecified)
The issue seems to be with mixing C/C++ with the repeated error:
/usr/include/c++/5/bits/cpp_type_traits.h:118:3:
2016 Aug 19
1
can't build from source: error: template with C linkage
...o rbv.o
> gcc -I/usr/share/R/include -DNDEBUG??????-fpic??-g -O2 -fstack-
> protector-strong -Wformat -Werror=format-security -Wdate-time
> -D_FORTIFY_SOURCE=2 -g??-O3 -Wall -pipe -pedantic -std=gnu99??-O3
> -pipe -std=gnu99 -Wno-maybe-uninitialized -Wno-unused-but-set-
> variable -c rtnorm.c -o rtnorm.o
> g++ -I/usr/share/R/include -DNDEBUG??????-fpic??-g -O2 -fstack-
> protector-strong -Wformat -Werror=format-security -Wdate-time
> -D_FORTIFY_SOURCE=2 -g??-O3 -Wall -pipe -Wno-unused??-O3 -pipe -Wno-
> maybe-uninitialized -Wno-unused-but-set-variable -c rtcmvnormR.cc -o
&...
2016 Aug 19
0
can't build from source: error: template with C linkage
...ut-set-variable -c rbv.cc -o rbv.o
gcc -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -O3 -Wall -pipe -pedantic -std=gnu99 -O3 -pipe -std=gnu99 -Wno-maybe-uninitialized -Wno-unused-but-set-variable -c rtnorm.c -o rtnorm.o
g++ -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -O3 -Wall -pipe -Wno-unused -O3 -pipe -Wno-maybe-uninitialized -Wno-unused-but-set-variable -c rtcmvnormR.cc -o rtcmvnormR.o
g++ -I/usr...
2009 Mar 10
6
Pseudo-random numbers between two numbers
I would like to generate pseudo-random numbers between two numbers using
R, up to a given distribution,
for instance, rnorm.
That is something like rnorm(HowMany,Min,Max,mean,sd) over
rnorm(HowMany,mean,sd).
I am wondering if
dnorm(runif(HowMany, Min, Max), mean, sd)
is good. Any idea? Thanks.
-james