Displaying 20 results from an estimated 1000 matches similar to: "Multivariate Normal and loops"
2012 Jun 17
3
How to save my result with Loops
Hi everyone, i'm not very good with R, and i know that my question is quite
simple.
I generated this vector for a sample of 100 and i want to know how to save
these as
ez1, ez1, ez3...ez100.
I guess i have to do it by "for", but i didn't succeed..
i put here my output
ezt
[1] -0.05470228 -1.76356668 -1.68843463 -0.77283767 0.25077826
-0.65236833 1.05230056 -0.48900254
2004 Jun 25
2
Simulating from a Multivariate Normal Distribution Using a Correlation Matrix
Hello,
I would like to simulate randomly from a multivariate normal distribution using a correlation
matrix, rho. I do not have sigma. I have searched the help archive and the R documentation as
well as doing a standard google search. What I have seen is that one can either use rmvnorm in
the package: mvtnorm or mvrnorm in the package: MASS. I believe I read somewhere that the latter
was
2009 May 18
2
Simulation from a multivariate normal distribution
I must to create an array with dimensions 120x8x500. Better I have to make 500 simulations of 8 series of return from a multivariate
normal distribution. there's the command "mvrnorm" but how I can do this repeating the simulation 500 times?"
[[alternative HTML version deleted]]
2007 Aug 13
1
simulate data from multivariate normal with pre-specified correlation matrix
For example, the correlation matrix is 3x3 and looks like
1 0.75 0 0 0
0.75 1 0 0 0
0 0 0 0 0
Can I write the code like this?
p<- 3 # number of variables per observation
N<- 10 # number of samples
# define population correlation matrix sigma
sigma<-matrix(0,p,p) #creates a px p matrix of 0
rank<-2
for (i in 1:rank){
for (j in 1:rank){
rho<-0.75
2003 Sep 30
2
truncated multivariate normal
Please,
I would like to know how to generate a truncated multivariate normal
distribution k - dimensional, X ~ NT(mu, Sigma), where the
elements of X to be non-negative (except the first), and the first
dimension is strictly larger than zero.
Example:
X ~ NT_2(mu, Sigma),
where mu=c(0.5, 0.5) and Sigma=c([120, 191], [191,154]), with X_1>0
and X_2>=0
Could anybody help
2008 May 09
1
Multivariate simulation
Dear everyone, I am having problem simulating multivariate data. Though I was able to simulate the data, but finding the variance-covariance matrix of simulated data did not give exact covariance matrix used in simulating the data. Unlike some other packages, like stata, using command "corr2data" will simulate data having the covariance matrix exactly with the specified covariance
2007 Nov 16
1
generate multivariate F with specified correlation matrix
Dear all,
In MATLAB, to generate multivariate F with specified correlation matrix Pn I can use the code such as
Z = mvnrnd([0 0 0 0 0], Pn, N);
U = normcdf(Z,0,1);
X = [finv(U(:,1),5,15) finv(U(:,2),5,15) finv(U(:,3),5,15) finv(U(:,4),5,15) finv(U(:,5),5,15)];
Is there something similar in R?
Thank you for your time.
2002 Dec 04
1
Mixture of Multivariate Gaussian Sample Data
Hey, I am confused about how to generate the sample data from a mixture of
Multivariate Gaussian ditribution.
For example, there are 2 component Gaussian with prior
probability of 0.4 and 0.6,
the means and variances are
u1=[1 1]', Cov1=[1 0;0 1]
and
u2=[-1 -1]', Cov2=[1 0;0 1]
repectively.
So how can I generate a sample of 500 data from the above mixture
distribution?
Thanks.
Fred
2005 May 03
1
multivariate Shapiro Wilks test
Hello,
I have a question about multivariate Shapiro-Wilks test.
I tried to analyze if the data I have are multivariate normal, or how
far they are from being
multivariate normal. However, any time I did
>mshapiro.test(mydata)
I get the message:
Error in solve.default(R %*% t(R), tol = 1e-18) :
system is computationally singular: reciprocal condition number
= 5.38814e-021
I tried
2002 Jan 23
6
multivariate simulation
To whom it may concern,
I try to simulate a non-normal multivariate distribution. The MASS package
allows by mean of "mvrnorm" command to perform a multivariate normal
simulation. Is there an equivalent command for an arbitrary multivariate
distribution available in the R-language?
Thank you in advance.
Bernard Colin
Colin Bernard
Professeur titulaire
D?partement de Math?matiques et
2008 Dec 08
1
Multivariate kernel density estimation
I would like to estimate a 95% highest density area for a multivariate
parameter space (In the context of anova). Unfortunately I have only
experience with univariate kernel density estimation, which is remarkebly
easier :)
Using Gibbs, i have sampled from a posterior distirbution of an Anova model
with k means (mu) and 1 common residual variance (s2). The means are
independent of eachother, but
2010 Nov 14
2
replace a row in a matrix
Dear all,
I created a n*2 matrix and I want to replace the ith row with a vector. Can
anyone suggest me what is the simple way to do it? Sorry for bothering you
with such simple question. I appreciate any hints or advice.
Thanks in advance.
Cassie
[[alternative HTML version deleted]]
2012 Oct 12
1
better example for multivariate data simulation question-please help if you can
Dear?All,
?
a few weeks ago I have posted a question on the R help listserv that?some of you have responded to with a great solution, would like to thank you for that? again.?I thought I would reach out to you with the issue I am trying to solve now. I have posted the question a few days ago, but probably it was not?clear enough, so I thought i try it again.?At times I have a multivariate example
2010 Nov 09
2
simulation from pareto distn
Dear all,
I am trying to simulate from truncated Pareto distribution. I know there is
a package called PtProcess for Pareto distribution...but it is not for
truncated one. Can anyone please help me with this?
Thanks in advance.
Cassie
[[alternative HTML version deleted]]
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.
2011 Apr 08
4
Simulation from discrete uniform
Dear all,
I am trying to simulate from discrete uniform distribution. But I could not
find any in-built code in R. Could anyone help me please?
Thanks in advance for the time and help.
Cassie
[[alternative HTML version deleted]]
2011 Feb 14
2
how to overlay a map of US on image plot
Dear all,
I have a data set which has latitude, longitude (not in increasing order)
and observed precipitation corresponding to those locations. I am using
image.plot command for that. But I want to overlay a map of US on that plot.
I know we can use map('usa') to draw it, but I dont know how can I overlay
it on the plot of the precipitation data. Can anyone please help me with it?
2011 Mar 08
1
defining an array with one of the elements being a vector
Dear all,
I am trying to define an array as follows:
a=array(NA,c(m,2,N,G)),
Even though the numbers N and G are fixed, m is a vector. So, I can't define
'a' as above.
For eg,
N=3
G=6,
but m=c(2,7,5) and length(m)=N.
Can anyone suggest me how can I define 'a' when m is a vector?
Thanks in advance for your help.
Cassie
[[alternative HTML version deleted]]
2010 Jul 29
2
Fry Plots
Does anyone know how to do a fry plot in R? I have 600-800 points per image, and I really don't want to attempt that manually.
Thank you!
Cassie
[[alternative HTML version deleted]]
2011 Jul 27
2
for loop help
I am having a hard time putting the below into a loop, where it pulls out ppt from all he stations I have versus having to go through and hard code the data to the specific stations. I tried
stnID <- stnid[which(duplicated(stnid)==FALSE)]
for(i in 1:length(stnID))
{
ppt[i] <- ppt[which(stnid==[i])]
}
but it doesn't like to use the which function inside a for loop? Any idea's here is