Displaying 20 results from an estimated 10000 matches similar to: "Calculating Variance-covariance matrix for a multivariate normal distribution."
2012 Feb 03
1
Simulating from "matrix variate normal distribution"
Hello everyone
Is there a function/command to simulate from "matrix variate normal
distribution" in R.
A follow up question would be is there a function/command to obtain the
density, distribution and quantile function of "matrix variate normal
distribution" in R.
Wikipedia has a good description of "matrix variate normal distribution"
which is also alternatively
2006 Nov 01
1
Fitting mean and covariance of Multivariate normal with censored data
Hello,
I have been googling for 2 days and I cannot find the answer in
previous posts.
I have a set of d-dimensional data elements (d=11 .. 14), each data
point can be censored at different values both
Lower-limit and upper limit.
N = 2000 sets of vectors of
D=11 data points per vector.
Each of the N*D points can have different upper and lower limits.
I "simply" want to fit a
2009 Jun 02
2
variance does not equal serial covariance of lag zero?
Dear all,
Does this make any sense:
var() = cov() != acf(lag.max=0, type="covariance")?
I have daily data of IBM for May 2005, and I'm using the logarithmic return:
> ibm200505$LRAdj.Close
[1] NA 0.0203152 0.0005508 -0.0148397 -0.0025182 0.0092025
-0.0013889
[8] 0.0098196 -0.0103757 -0.0274917 0.0005716 -0.0159842 -0.0074306
0.0091710
[15] 0.0002898 0.0226306
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
2006 Jul 01
5
generate bi-variate normal data
Dear all,
I would like to generate bi-variate normal data given that the first column
of the data is known. for example:
I first generate a set of data using the command,
x <- rmvnorm(10, c(0, 0), matrix(c(1, 0, 0, 1), 2))
then I would like to sum up the two columns of x:
x.sum <- apply(x, 1, sum)
now with x.sum I would like to generate another column of data, say y, that
makes
2008 Sep 27
1
Using "by" to create individual variance-covariance matrices
Hello R list subscribers,
I am trying to use the "by" command to create line-specific variance covariance matrices (where "x" is the original data matrix):
by(x, x$line, function(d) {
d.clean <- d[,-1]})
write.table(d.clean$line[1,1], sep = ",", file = "covariances.csv", col.names = FALSE, row.names = FALSE, append = TRUE)
write.table("", sep
2004 Nov 05
1
covariance bug (PR#7342)
Full_Name: Christian Lederer
Version: 1.8.0
OS: Linux
Submission from: (NULL) (217.229.7.13)
R-1.8.0 seems to calculate wrong covariances, when the argument of cov()
is a matrix or a data frame.
The following should produce a matrix of zeroes and NaNs:
x <- matrix(c(NA ,NA ,0.9068995 ,NA ,-0.3116229,
-0.06011117 ,0.7310134 ,NA ,1.738362 ,0.6276125,
0.6615581 ,NA
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
2010 May 18
1
proportion of treatment effect by a surrogate (fitting multivariate survival model)
Dear R-help,
I would like to compute the variance for the proportion of treatment
effect by a surrogate in a survival model (Lin, Fleming, and De
Gruttola 1997 in Statistics in Medicine). The paper mentioned that
the covariance matrix matches that of the covariance matrix estimator
for the marginal hazard modelling of multiple events data (Wei, Lin,
and Weissfeld 1989 JASA), and is implemented
2006 Nov 18
3
Random sample from log-normal distribution
Dear all R users,
Please forgive me if my question is too trivial.
Suppose I have two variables, (x,y) which is
log-normally distributed with expected value (mu1,
mu2) and some variance-covariance matrix. Now I want
to draw a random sample of size 1000 from this
distribution. Is there any function available to do
this?
Thanks and regards,
Megh
2004 Jan 29
2
Calculating/understanding variance-covariance matrix of logistic regression (lrm $var)
Hallo!
I want to understand / recalculate what is done to get
the CI of the logistic regression evaluated with lrm.
As far as I came back, my problem is the
variance-covariance matrix fit$var of the fit
(fit<-lrm(...), fit$var). Here what I found and where
I stucked:
-----------------
library(Design)
# data
D<-c(rep("a", 20), rep("b", 20))
V<-0.25*(1:40)
V[1]<-25
2008 Dec 15
2
Using a covariance matrix as input to relaimpo package
I'm having trouble getting the relaimpo package to use a covariance matrix as
input. I'm getting an error message that reads as follows:
Error in eval(m$weights, data, parent.frame()) :
numeric 'envir' arg not of length one
I'm guessing there is something wrong with the structure of my covariance
matrix, but it looks fine to me. Pardon my R ignorance if this is an easy
2010 Aug 24
3
generate random numbers from a multivariate distribution with specified correlation matrix
Hi all,
rmvnorm()can be used to generate the random numbers from a multivariate
normal distribution with specified means and covariance matrix, but i want
to specify the correlation matrix instead of covariance matrix for the
multivariate
normal distribution.
Does anybody know how to generate the random numbers from a multivariate
normal distribution with specified correlation matrix? What about
2003 Jan 16
1
Multivariate regression in R
Hi Folks,
I want to do multivariate regression in R, i.e. basically
(but with a complication -- see below):
given an Nxp matrix Y of p-variate responses, and an Nxk
matrix X of covariates, to fit the model
Y = X*B + e
with estimation of the kxp matrix of coefficients B
and estimation of the pxp matrix of covariances between
the p variates in Y.
I haven't managed to find a
2004 Nov 05
1
Covariance bug in R-1.8.0
R-1.8.0 seems to calculate wrong covariances, when the argument of cov()
is a matrix or a data frame.
The following should produce a matrix of zeroes and NaNs:
x <- matrix(c(NA ,NA ,0.9068995 ,NA ,-0.3116229,
-0.06011117 ,0.7310134 ,NA ,1.738362 ,0.6276125,
0.6615581 ,NA ,NA ,-2.646011 ,-2.126105,
NA ,1.081825 ,NA ,1.253795 ,1.520708,
2010 Apr 12
1
Strange results from Multivariate Normal Density
Hello,
I'm using dmnorm from the package {mnormt} and getting strange results.
First, according to the documentation, dmnorm should return a vector of
densities, and I'm only getting one value returned (which is what I would
expect). I've been interpreting this as the joint density of all values in
the x vector (which is what I want). Should a vector of densities be
returned, and if
2007 Feb 13
1
simulating from Langevin distributions
Dear all,
I have been looking for a while for ways to simulate from Langevin distributions and I thought I would ask here. I am ok with finding an algorithmic reference, though of course, a R package would be stupendous!
Btw, just to clarify, the Langevin distribution with (mu, K), where mu is a vector and K>0 the concentration parameter is defined to be:
f(x) = exp(K*mu'x) / const where
2005 Aug 03
1
multivariate F distribution
Dear List,
Is there any function in R to generate multivariate F distribution with
given correlation/covariance matrix?
Actually, I just want to generate some 2-dimentional non-normal data
sets (skewed) for low (may be around 0.3 cor coeff.) negatively and also
positively correlated variables ?
Thanks in advance.
Anna
2004 Jan 20
1
evaluation of discriminant functions+multivariate homosce dasticity
While I don't know anything about Box's M test, I googled around and found a
Matlab M-file that computes it. Below is my straight-forward translation of
the code, without knowing Matlab or the formula (and done in a few minutes).
I hope this demonstrates one of Prof. Ripley's point: If you really want to
shoot yourself in the foot, you can probably program R to do that for you.
[BTW:
2010 Nov 06
1
How to generate multivariate uniform distribution random numbers?
I wish to generate 100 by 1 vector of x1 and x2 both are uniform distributed
with covariance matrix \Sigma.
Thanks,
Michael
[[alternative HTML version deleted]]