Displaying 11 results from an estimated 11 matches for "_matrix_".
2012 Feb 23
5
cor() on sets of vectors
...2,...,xN and y1,y2,...,yN.
I want N correlations: cor(x1,y1), cor(x2,y2), ..., cor(xN,yN).
my sets of vectors are arranged as data frames x & y (vector=column):
x <- data.frame(a=rnorm(10),b=rnorm(10),c=rnorm(10))
y <- data.frame(d=rnorm(10),e=rnorm(10),f=rnorm(10))
cor(x,y) returns a _matrix_ of all pairwise correlations:
cor(x,y)
d e f
a 0.2763696 -0.3523757 -0.373518870
b 0.5892742 -0.1969161 -0.007159589
c 0.3094301 0.1111997 -0.094970748
which is _not_ what I want.
I want diag(cor(x,y)) but without the N^2 calculations.
thanks.
--
Sam Steingold...
2006 Mar 24
3
Date in dataframe manipulation
Hi,
I have a dataframe with many columns, including date and I want to keep
only a few of the columns including date column.
I used the following command:
with(FireDataAppling, cbind(STARTDATE, County, TOTAL, CAUSE)
It works, but the date becomes days from Jan 1, 2001.
FireDataAppling$STARTDATE[1] gives
[1] 2001-01-04 00:00:00
1703 Levels: .........
After the cbind command, the entry
2005 Apr 20
1
window closed
Hello,
The editor of R will close after I enter the following commands. I do not know the reason at all. When does this happen? I would very appreciate it if you could let me know.
Sincerely.
=====
gam <- matrix(scan("C:/Documents and Settings/Yoko N/Desktop/R/sas2.txt"), ncol = 29)
Read 384132 items
Warning message:
Replacement length not a multiple of the elements to replace in
2011 Jan 21
0
Possible bug in Spearman correlation with use="pairwise.complete.obs"
...regards to
the treatment of NAs when calculating Spearman correlations. I guess it
is a subtle bug.
If I understand the help page correctly, the two modes 'complete.obs'
and 'pairwise.complete.obs' specify how to deal with correlation
coefficients when calculating a correlation _matrix_. When calculating a
single (scalar) correlation coefficient for two data vectors x and y,
both should give the same result.
For Pearson correlation, this is in fact the case:
> x <- runif( 10 )
> y <- runif( 10 )
> y[5] <- NA
> cor( x, y, use="complete.obs" )
[1]...
2007 Apr 23
1
Package installed, functional but not available
Hello,
when I run packageStatus(), I get the following results:
> packageStatus()
Number of installed packages:
ok upgrade unavailable
/home/fernando/my_library 38 0 1
/usr/local/lib/R/library 28 0 0
Number of available packages (each package/bundle counted only once):
installed
2010 Aug 03
2
incorrect number of dimensions
Hi,
How to solve this problem. The following is the code.
betabinexch0=function(theta,data)
+ {
+ eta=theta[,1]
+ K=theta[,2]
+ y=data[,1]; n=data[,2]
+ N=length(y)
+ val=0*K;
+ for (i in 1:N)
+ val=val+lbeta(K*eta+y[i],K*(1-eta)+n[i]-y[i])
+ val=val-N*lbeta(K*eta,K*(1-eta))
+ val=val-2*log(1+K)-log(eta)-log(1-eta)
+ return(val)
+ }
> data(cancermortality)
>
2008 Dec 29
4
Merge or combine data frames with missing columns
Hi R-experts,
suppose I have a list with containing data frame elements:
[[1]]
(Intercept) y1 y2 y3 y4
-6.64 0.761 0.383 0.775 0.163
[[2]]
(Intercept) y2 y3
-3.858 0.854 0.834
Now I want to put them into ONE dataframe like this:
(Intercept) y1
2001 Nov 12
3
'subscript out of bounds' in matrices
Dear list
Having read through all the archives of the mailing lists, I've had no
luck finding the answer to my problem.
I am running a for(i in 1:n) loop and am creating a matrix, p, for each
of the n observations. This matrix p is a 2x1 matrix. I am then doing
the following:
diagp<-diag(c(p[1,1],p[2,1]))
to create a matrix with the elements of P on the diagonal (i.e. a 4x4
matrix).
2019 Apr 26
0
R 3.6.0 is released
...tead of u %*% t(v).
* vcov(<mlm>) is more efficient via new optional arguments in
summary.mlm().
* The default method of summary() gets an option to choose the
_kind_ of quantile()s to use; wish of PR#17438.
* Fitting multiple linear models _via_ lm() does work with _matrix_
offsets, as suggested in PR#17407.
* The new functions mem.maxVSize() and mem.maxMSize() allow the
maximal size of the vector heap and the maximal number of nodes
allowed in the current R process to be queried and set.
* news() gains support for NEWS.md files.
* An...
2019 Apr 26
0
R 3.6.0 is released
...tead of u %*% t(v).
* vcov(<mlm>) is more efficient via new optional arguments in
summary.mlm().
* The default method of summary() gets an option to choose the
_kind_ of quantile()s to use; wish of PR#17438.
* Fitting multiple linear models _via_ lm() does work with _matrix_
offsets, as suggested in PR#17407.
* The new functions mem.maxVSize() and mem.maxMSize() allow the
maximal size of the vector heap and the maximal number of nodes
allowed in the current R process to be queried and set.
* news() gains support for NEWS.md files.
* An...
2019 Apr 26
0
R 3.6.0 is released
...tead of u %*% t(v).
* vcov(<mlm>) is more efficient via new optional arguments in
summary.mlm().
* The default method of summary() gets an option to choose the
_kind_ of quantile()s to use; wish of PR#17438.
* Fitting multiple linear models _via_ lm() does work with _matrix_
offsets, as suggested in PR#17407.
* The new functions mem.maxVSize() and mem.maxMSize() allow the
maximal size of the vector heap and the maximal number of nodes
allowed in the current R process to be queried and set.
* news() gains support for NEWS.md files.
* An...