similar to: Generating random numbers satisfying specific regression equation

Displaying 20 results from an estimated 10000 matches similar to: "Generating random numbers satisfying specific regression equation"

2018 Mar 04
2
lmrob gives NA coefficients
Thanks for your reply. I use mvrnorm from the *MASS* package and lmrob from the *robustbase* package. To further explain my data generating process, the idea is as follows. The explanatory variables are generated my a multivariate normal distribution where the covariance matrix of the variables is defined by Sigma in my code, with ones on the diagonal and rho = 0.15 on the non-diagonal. Then y
2018 Mar 04
0
lmrob gives NA coefficients
What is 'd'? What is 'n'? On Sun, Mar 4, 2018 at 12:14 PM, Christien Kerbert < christienkerbert at gmail.com> wrote: > Thanks for your reply. > > I use mvrnorm from the *MASS* package and lmrob from the *robustbase* > package. > > To further explain my data generating process, the idea is as follows. The > explanatory variables are generated my a
2018 Mar 04
1
lmrob gives NA coefficients
d is the number of observed variables (d = 3 in this example). n is the number of observations. 2018-03-04 11:30 GMT+01:00 Eric Berger <ericjberger at gmail.com>: > What is 'd'? What is 'n'? > > > On Sun, Mar 4, 2018 at 12:14 PM, Christien Kerbert < > christienkerbert at gmail.com> wrote: > >> Thanks for your reply. >> >> I use
2018 Mar 03
0
lmrob gives NA coefficients
> On Mar 3, 2018, at 3:04 PM, Christien Kerbert <christienkerbert at gmail.com> wrote: > > Dear list members, > > I want to perform an MM-regression. This seems an easy task using the > function lmrob(), however, this function provides me with NA coefficients. > My data generating process is as follows: > > rho <- 0.15 # low interdependency > Sigma <-
2011 Jul 06
1
Create simulated data's using mvrnorm
Hi All This might be something very trivial but I seem to miss something in the syntax or logic which makes me keep wandering around the problem without arriving at a solution. What I want to do is to simulate a sample data for performing cluster analysis. I tried to use x1= mvrnorm(10,rep(0.8,3),diag(3)) x2= mvrnorm(10,rep(0,3),diag(3)) x3= mvrnorm(10,rep(-0.5,3),diag(3)) x=rbind(x1,x2,x3)
2008 Jun 26
2
constructing arbitrary (positive definite) covariance matrix
Dear list, I am trying to use the 'mvrnorm' function from the MASS package for simulating multivariate Gaussian data with given covariance matrix. The diagonal elements of my covariance matrix should be the same, i.e., all variables have the same marginal variance. Also all correlations between all pair of variables should be identical, but could be any value in [-1,1]. The problem I am
2011 Jan 22
1
faster mvrnorm alternative
Hello, does anybody know another faster function for random multivariate normal variable simulation? I'm using mvrnorm, but as profiling shows, my algorithm spends approximately 50 % in executing mvrnorm function. Maybe some of you knows much faster function for multivariate normal simulation? I would be very gratefull for advices. -- View this message in context:
2004 Feb 02
3
mvrnorm problem
I am trying to simulate draws from a multivariate normal using mvrnorm, and am getting the following error message: Error in mu + eS$vectors %*% diag(sqrt(pmax(ev, 0)), p) %*% t(X) : non-conformable arrays I do not understand why I am getting this message, since the vector of means I am giving to the function is 13 by 1 and the variance matrix I am giving to the function is 13
2005 May 01
2
eigen() may fail for some symmetric matrices, affects mvrnorm()
Hi all, Recently our statistics students noticed that their Gibbs samplers were crashing due to some NaNs in some parameters. The NaNs came from mvrnorm (Ripley & Venables' MASS package multivariate normal sampling function) and with some more investigation it turned out that they were generated by function eigen, the eigenvalue computing function. The problem did not seem to happen
2018 Mar 03
2
lmrob gives NA coefficients
Dear list members, I want to perform an MM-regression. This seems an easy task using the function lmrob(), however, this function provides me with NA coefficients. My data generating process is as follows: rho <- 0.15 # low interdependency Sigma <- matrix(rho, d, d); diag(Sigma) <- 1 x.clean <- mvrnorm(n, rep(0,d), Sigma) beta <- c(1.0, 2.0, 3.0, 4.0) error <- rnorm(n = n,
2005 Jan 06
2
Generating Data mvrnorm and loops
Dear List: I am generating N datasets using the following Sigma<-matrix(c(400,80,80,80,80,400,80,80,80,80,400,80,80,80,80,400),4,4 ) mu<-c(100,150,200,250) N=100 for(i in 1:N) { assign(paste("Data.", i, sep=''), as.data.frame(cbind(seq(1:1000),(mvrnorm(n=1000, mu, Sigma))))) } With these datasets, I need to work on some of the variables and then run each dataset
2011 Feb 24
3
problem in for loop
Hi all. I was having some trouble with a for loop and I found the problem is the following. Does anyone have some idea why I got the following R result? Since mone is equal to 3, why mu1 only have 2 components? library(MASS) > p0 <- seq(0.1, 0.9,by=0.1) > m <- 10 > > > p0 <- p0[7] > > ## data generation > > mzero <- p0*m > mone <- m-mzero >
2011 Aug 28
1
R question: generating data using MASS
Hi, all! I'm new to R but need to use it to solve a little problem I'm having with a paper I'm writing. The question has a few components and I'd appreciate guidance on any of them. 1. The most essential thing is that I need to generate some multivariate normal data on a restricted integer range (1 to 7). I know I can use MASS mvrnorm command to do this but have a couple questions
2008 Nov 11
1
simulate data with binary outcome and correlated predictors
Hi, I would like to simulate data with a binary outcome and a set of predictors that are correlated. I want to be able to fix the number of event (Y=1) vs. non-event (Y=0). Thus, I fix this and then simulate the predictors. I have 2 questions: 1. When the predictors are continuous, I can use mvrnorm(). However, if I have continuous, ordinal and binary predictors, I'm not sure how to simulate
2011 May 07
1
generate multiple mvrnorm samples using apply-like
I want to generate multiple multivariate normal samples with different mean vectors and common covariance matrix. I can do this with a loop, but can't quite figure out how to do it with apply and friends. In the example below, I want values to have 3 columns: group, x, y # number of groups, and group means x <- jitter(seq(2,10,by=2)) y <- x + rnorm(length(x), 0, .5) means <-
2007 Jun 12
4
Generating artificial datasets with a specific correlation coefficient.
I need to create artificial datasets with specific correlation coefficients (i.e. a dataset that returns r = 0.30, etc.) as examples for a lab I am teaching this summer. Is there a way to do that in R? Thanks. Jim Milks Graduate Student Environmental Sciences Ph.D. Program 136 Biological Sciences Wright State University 3640 Colonel Glenn Hwy Dayton, OH 45435 [[alternative HTML version
2006 May 05
2
Including a single function from a package
Hello all. I'm building a package where I want to include a function from two different packages. In particular, I want to include mvrnorm and hyperg_2F1 from MASS and gsl, respectively (but the specific functions do not matter). With what I've tried after reading the "Specifying imports and exports" section from the "Writing R Extensions" manual, I get an error:
2007 Dec 17
2
regression towards the mean, AS paper November 2007
Dear friends, regression towards the mean is interesting in medical circles, and a very recent paper (The American Statistician November 2007;61:302-307 by Krause and Pinheiro) treats it at length. An initial example specifies (p 303): "Consider the following example: we draw 100 samples from a bivariate Normal distribution with X0~N(0,1), X1~N(0,1) and cov(X0,X1)=0.7, We then calculate
2008 Jul 05
5
help about random generation of a Normal distribution of several variables
Hello. Somebody knows how can I generate a set of n random vectors of a normal distribution of several variables? For example, I want to generate n=100 random vectors of two dimensions for a normal with mean c(0,1) and variance matrix: matrix(c(2,1,1,3),2,2). Thanks in advance, Arnau.
2007 Mar 16
1
ideas to speed up code: converting a matrix of integers to a matrix of normally distributed values
Hi all, [this is a bit hard to describe, so if my initial description is confusing, please try running my code below] #WHAT I'M TRYING TO DO I'd appreciate any help in trying to speed up some code. I've written a script that converts a matrix of integers (usually between 1-10,000 - these represent allele names) into two new matrices of normally distributed values (representing