similar to: mvdnorm???

Displaying 20 results from an estimated 80000 matches similar to: "mvdnorm???"

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
2007 Sep 17
1
Create correlated data with skew
Hi all, I understand that it is simple to create data with a specific correlation (say, .5) using mvrnorm from the MASS library: > library(MASS) > set.seed(1) > > a=mvrnorm( + n=10 + ,mu=rep(0,2) + ,Sigma=matrix(c(1,.5,.5,1),2,2) + ,empirical=T + ) > a [,1] [,2] [1,] -1.0008380 -1.233467875 [2,] -0.1588633 -0.003410001 [3,] 1.2054727 -0.620558768
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:
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
2003 Oct 28
1
Loading a "sub-package"
Hi Folks, The inspiration for this query is described below, but it prompts a general question: If one wants to use only one or a few functions from a library, is there a way to load only these, without loading the library, short of going into the package source and extracting what is needed (including of course any auxiliary functions and compiled code they may depend on)? What prompted this
2005 Jan 17
1
pairs: altering pch options on upper and lower panel of pairwise scatter plots
Hello, I can't figure out how to use the upper.panel and lower.panel options in pairs to alter the label options for either panel independently of the other. I would like to be able to show the pairwise scatter plots for the data as they are (a vanilla pairs plot?) but separately to be able to label the points according to a factor level. It is easy enough to do this independently, but I
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 >
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
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
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
2009 Nov 11
1
Loadings and scores from fastICA?
Hi all, Does anyone know how to get the independent components and loadings from an Independent Component Analysis (ICA), as well as principal components and loadings from a Pricipal Component analysis (PCA) using the fastICA package? Or perhaps if there's another way to do ICAs in R? Below is an example from the fastICA manual (http://cran.r-project.org/web/packages/fastICA/fastICA.pdf)
2010 Apr 08
1
a small question about R with Winbugs
I try to do a test for dirichlet process for Multivariate normal, but Winbugs always says "expected multivariate node", does that mean I miss something at initialization? I will really appreciate the help to solve this problem Here is the R code, and Winbugs code. model { for(i in 1:N){ y[i,1:2] ~ dmnorm(mu[i,],tau[i,,]) S[i] ~ dcat(pi[]) mu[i,1:2] <- mu.star[S[i],]
2016 Jul 17
2
Muestrear de una normal multivariante.-
¡Hola a todos! Estoy intentando muestrear de una normal multivariante donde hay dos grupos de variables que deben tener una relación "manipulable" entre sí pero ignoro cómo hacerlo. Les cuento, he intentado lo siguiente: # covarianzas del primer grupo de variables: Sigma_U <- matrix(c(.25, .2, .2, .25), ncol=2) # covarianzas del segundo grupo de variables: Sigma_W <- diag(2) #
2002 Mar 02
1
pmvnorm?
Dear all, The MASS library provides a mvrnorm function to generate random numbers from a multivariate normal distribution, similar to S-Plus's rmvnorm, but is there an R-equivalent to pmvnorm, which generates probabilities from a multivariate normal? With thanks, John Field -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read
2013 Oct 15
1
plotting a marginal distribution on the plane behind a persp() plot
R'istas: I am trying to plot a marginal distribution on the plane behind a persp() plot. My existing code is: library(MASS) X <- mvrnorm(1000,mu=c(0,0),Sigma=matrix(c(1,0,0,1),2)) X.kde <- kde2d(X[,1],X[,2],n=25) # X.kde is list: $x 1*n, $y 1*n, $z n*n persp(X.kde,phi=30,theta=60,xlab="x_b",ylab="x_a",zlab="f") ->res Any suggestions are very
2018 Mar 04
0
lmrob gives NA coefficients
Hard to help you if you don't provide a reproducible example. On Sun, Mar 4, 2018 at 1:05 PM, Christien Kerbert < christienkerbert at gmail.com> wrote: > 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
2005 Sep 09
2
Simulate phi-coefficient
Looking for help with the following problem. Given a sample of zeros and ones, for example: > VECTOR1<-rep(c(1,0),c(15,10)) > VECTOR1 [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 How would I create a new sample (VECTOR2) also containing zeros and ones, in which the phi-coefficient between the two sample vectors was drawn from a population with a known
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
2012 Feb 08
2
How to stop a loop for?
Hi all, I have some time trying to find a way to stop a loop for( ) until the user presses the enter key or any other one and the loop can continue. This could be an example: library(MASS) data <- data.frame(mvrnorm(1000,rep(0,5),Sigma=diag(1,5))) for(i in 1:dim(data)[2]){ plot(density(data[,i]), main=paste('histogram',i)) #here something like waituntil command } Thank's in
2005 Jan 20
1
Windows Front end-crash error
Dear List: First, many thanks to those who offered assistance while I constructed code for the simulation. I think I now have code that resolves most of the issues I encountered with memory. While the code works perfectly for smallish datasets with small sample sizes, it arouses a windows-based error with samples of 5,000 and 250 datasets. The error is a dialogue box with the following: "R