Displaying 20 results from an estimated 4000 matches similar to: "Multivariate regression in R"
2006 Mar 18
0
No subject
To estimate the covariance matrix of e you could use the sample
covariance matrix of the residuals. If desired, use its cholesky
decomposition to transform to make the error approximately
uncorrelated, then refit (and back-transform the coefficient matrix).
Stacking the columns of Y and replicating X won't do what you write;
it forces each univariate regression to have the same coefficients.
2003 Jul 15
0
Multivariate regression method
Hi Folks,
Thanks to several people's suggestions and clarifications,
I think I have implemented a function which computes the
conditional mean and covariance matrix of a subset of the
dimensions of an MV-normal variable, given the values on the
other dimensions (these conditioning value can be presented
as a matrix, to deal with several cases at once).
The code is below, for anyone who would
2009 Mar 30
1
Setting the names attribute of a list?
Hello,
I have created a vector with 2 elements(see code below)
I am calling this function many thousands of times (hundreds of
thousands) after some time
i get
*** caught segfault ***
address 0x5, cause 'memory not mapped'
However, if i dont set the R_NamesSymbol, I do not get any such error.
Am I doing this correctly?
Thank you
Saptarshi
==CODE===
// kxp and usar are two SEXP's
1997 May 11
2
R-alpha: Logarithmic scales
Here are another three problems with logarithmic scales:
1) segments() does not work with logarithmic scales. I suggest to change
lines 962-973 in "plot.c":
for (i = 0; i < n; i++) {
if (FINITE(xt(x0[i%nx0])) && FINITE(yt(y0[i%ny0]))
&& FINITE(xt(x1[i%nx1])) && FINITE(yt(y1[i%ny1]))) {
GP->col = INTEGER(col)[i % ncol];
2008 Jun 16
0
Creating correlated multivariate dataset
Hello list,
I am trying to test a model but for the beginning I want to do this by using simulated dataset. The model is
Y_t = X_t %*% beta + e
Where Y : (Nx1); X: (Nxp); beta: (0.6,0.3,0.1); e-uncorrelated normally distributed variates for each t. and later I want to use to use this dataset in a BUGS model to estimate the betas.
Thank you for you consideration.
[[alternative
2009 Jan 19
2
Using apply to generate matrix from rows?
Dear all,
I have a simple question which I unfortunately do not seem to be able
to solve myself. I have a (NxK) matrix and want to generate a new
matrix by multiplying each row with itself such that the new matrix
has dimension ((N*K)xK) (or better, generate an array with dimension
(K,K,N)). I tried apply, but that did not work. Any suggestions?
Thanks!
Stephan
## Here is a simple
2007 Apr 28
2
Calculating Variance-covariance matrix for a multivariate normal distribution.
Dear all R users,
I wanted to calculated a sample Variance covariance matrix of a five-variate normal distribution. However I stuck to calculate each element of that matrix. My question is should I calculate ordinary variance and covariances, taking pairwise variables? or I should take partial covariance between any two variables, keeping other fixed. In my decent opinion is I should go for the
2010 Nov 17
1
Multiple Line Plots with xyplot
I'm trying to make multiple line plots, each with a different color, using the xyplot command. Specifically, I have an NxK matrix Y and an Nx1 matrix x. I would like the plot to contain a line for each (x, Y[,i]), i=1:K. I know something like
xyplot(Y[,1] + Y[,2] + Y[,3] ~ x, type='l')
will work, but if Y is large, this notation can get very awkward. Is there a way to do something
2003 Jul 06
1
Conditional Distribution of MVN variates
Hi Folks,
Given k RVs with MVN distribution N(mu,S) (S a kxk covariance matrix),
let (w.l.o.g.) X1 denote the first r of them, and X2 the last (k-r).
Likewise, let mu1 and mu2 denote their respective expectations.
Then, of course, the expectation of X2 given X1=x1 is
mu2 + S21*inv(S22)*(x1 - mu1)
and the covariance matrix of X2 given X1=x2 is
S22 - S21*inv(X11)*S12
where Sij is the
2006 Jan 19
1
Minimizing mahalanobis distance to negative orthant
Hi
I have the following problem: given x (px1) and S (pXp positive definite), find y such that y_i<=0 (i=1..p) minimizing the
mahalanobis distance (x-y)'S^{-1}(x-y).
Has anyone worked on this problem? Tips or R code would be appreciated.
David
____________________
David Edwards
Principal scientist
Biostatistics
Novo Nordisk A/S
Novo Allé
2880 Bagsvaerd
Denmark
+45 4444 8888 (phone)
2006 Aug 03
1
geodesic distance
Hi,
has anyone ever seen implemented in R the following "geodesic"
distance between positive definite pxp matrices A and B?
d(A,B) = \sum_{i=1}^p (\log \lambda_i)^2
were \lambda is the solution of det(A -\lambda B) = 0
thanks
stefano
2001 May 14
0
followup: lookup function for density(...) objects
Thanks to Ross Ihaka and Bob Wheeler for responding to my earlier question. I
looked into the Johnson system functions in SuppDists package. For now, I want
to stick with the density(...) estimator, and so still need the variate lookup
function.
As per Ross' suggestion, I just did a numerical integration on the density
object and used approxfun/splinefun to "lookup" the variate
2004 Dec 06
0
What is the most useful way to detect nonlinearity in lo
> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of
> Ted.Harding at nessie.mcc.ac.uk
> Sent: Sunday, December 05, 2004 7:14 PM
> To: r-help at stat.math.ethz.ch
> Subject: Re: [R] What is the most useful way to detect
> nonlinearity in lo
>
>
> On 05-Dec-04 Peter Dalgaard wrote:
2013 Aug 23
0
Simulated mixed distribution multivariate data
Hi,
I want to simulate multivariate data with > 1 distribution type. For
example, I would like one normal variate and one poisson variate with a
specified correlation structure. Is there a package that has this
implemented?
Thanks.
Chuck
[[alternative HTML version deleted]]
2006 Oct 06
1
Sum of Bernoullis with varying probabilities
Hi Folks,
Given a series of n independent Bernoulli trials with
outcomes Yi (i=1...n) and Prob[Yi = 1] = Pi, I want
P = Prob[sum(Yi) = r] (r = 0,1,...,n)
I can certainly find a way to do it:
Let p be the vector c(P1,P2,...,Pn).
The cases r=0 and r=n are trivial (and also are exceptions
for the following routine).
For a given value of r in (1:(n-1)),
library(combinat)
Set <- (1:n)
2006 Jul 21
0
connection to X11 problem: problem fixed
Hi,
I finally managed to make it work (I just needed to have a X11 window
open).
Thank you very much for your help.
Agnes
-----Original Message-----
From: Ted Harding [mailto:Ted.Harding at nessie.mcc.ac.uk]
Sent: Friday, July 21, 2006 3:34 PM
To: Paquet, Agnes
Cc: r-help at stat.math.ethz.ch
Subject: RE: [R] connection to X11 problem
On 21-Jul-06 Paquet, Agnes wrote:
> Dear List,
>
2010 Sep 14
0
influence measures for multivariate linear models
I'm following up on a question I posted 8/10/2010, but my newsreader
has lost this thread.
> Barrett & Ling, JASA, 1992, v.87(417), pp184-191 define general
> classes of influence measures for multivariate
> regression models, including analogs of Cook's D, Andrews & Pregibon
> COVRATIO, etc. As in univariate
> response models, these are based on leverage and
2003 Oct 20
0
aliases
How about:
nis.na <- complete.cases
---
From: <Ted.Harding at nessie.mcc.ac.uk>
Hi Folks,
My recent response to Laura Quinn's query about matrix subsetting
reminded of a question.
I wrote:
iDir <- ((Winds[,20]<45)|(Winds[,20]>315))&(!is.na(Winds[,20]))
Now, I find "!is.na" a bit awkward to type, so I might prefer to
type it as "nis.na".
2006 Feb 27
1
Query on multivariate time series
Hi,
Could anyone inform how to perform multi-variate auto regression using
the past 't' values for regression in R. I have looked at ARMA
provided by DES library and mvr provided by PLS library but could not
match them to my requirements.
Specifically, I want the following
Say I have attributes a1-a4. and the regression equation is as follows:
a4(t) =
2004 Nov 15
1
Multivariate Sampling
Dear all,
I am looking for routines which allow multi-variate sampling from
non-normal distributions (loglogistic) given correlations among the
variables.
Unfortunately, I could not find a suitable package for R. Does
anybody know one?
Many thanks and best regards,
Stefan Albrecht
[[alternative HTML version deleted]]