Displaying 20 results from an estimated 1200 matches similar to: "help computing a covariance"
2008 Apr 29
1
NumDeriv - derivatives of covariance matrix
Hello R-help,
I need to compute matrices of first derivatives of a covariance matrix C
with entries given by c_ij=theta*exp(-0.5* sum(eta*(x[i,]-x[j,])^2)), wrt to
elements of eta, a m-dimensional vector of parameters, given a n*m data
matrix x. So far, I have been computing matrices for each parameter (given
by par[index]) analytically, using the following
kmatder<- function(x, par, index) {
2006 Sep 18
1
Cochrans Q Test
Hi!
I would like to conduct a Cochran`s Q Test in R, but have not found any
suitable function.
My first idea was: J <- as.table(matrix(c(6,16,2,4),ncol=2, dimnames =
list("C" = c("Favorable","Unfavorable"),"Drug A Favorable"=c("B
Favorable","B Unfavorable"))))
L <- as.table(matrix(c(2,4,6,6),ncol=2, dimnames =
2009 Jun 04
4
Cochran’s Q statistic
Does anyone know which package include the computation of Cochran’s Q
statistic in R?
jlfmssm
[[alternative HTML version deleted]]
2009 Nov 18
1
Cochran's Theorem
I want to understand ANOVA better. But a few textbook that I have do
not describe Cochran's Theorem in details. Could somebody recommend a
book for me?
2011 Aug 15
2
plotting segments only and in color
Hello,
I've a question concerning the display of interval data.
A sample dataset where X is an interval between Xa and Xb
which should be displayed:
Y=c(15,14,23,18,19,9,19,13)
Xa=c(17,22,21,18,19,25,8,19)
Xb=c(22,22,29,34,19,26,17,22)
X = (Xa+Xb)/2
It's easily possible to plot the mean of the interval like:
plot(X,Y)
afterwards I can create lines for the interval with:
2011 Mar 06
4
sorting & subsetting a data.frame
Dear all
This may be obvious, but I cannot get it working. I'm trying to subset
& sort a data frame in one go.
x <- iris
x$Species1 <- as.character(x$Species)
##subsetting alone works fine
with(x, x[Sepal.Length==6.7,])
##sorting alone works fine
with(x, x[order(Sepal.Length, rev(sort(Species1))),])
##gets subsetted, but not sorted as expected
with(x, x[(Sepal.Length==6.7) &
2010 Dec 29
1
Problem applying Chi-square in R and Cochran's Recommendations
Sir,
I have a problem here while applying chisquare test to the following Data (
below the subject of this mail) ...when I wanted to test the significance
using three different free statistical packages, here R, EpiInfo and
OpenEpi.
*Only OpenEpi accepts the test based on Cochran's Recommendations. *
R says " chi squared approximation may be incorrect."
Does it mean the same as
2011 Nov 22
5
x, y for point of intersection
Hi everyone,
?
I am trying to get a point of intersection between a
polyline and a straight line ?.. and get the x and y coordinates of this point.
For exemplification consider this:
?
?
set.seed(123)
?
k1 <-rnorm(100, mean=1.77, sd=3.33)
?k1 <- sort(k1)
q1 <- rnorm(100, mean=2.37, sd=0.74)
q1 <- sort(q1, decreasing = TRUE)
plot(k1, q1, xlim <- c((min(k1)-5),
2012 Feb 09
1
Constraint on one of parameters.
Dear all,
I have a function to optimize for a set of parameters and want to set a
constraint on only one parameter. Here is my function. What I want to do is
estimate the parameters of a bivariate normal distribution where the
correlation has to be between -1 and 1. Would you please advise how to
revise it?
ex=function(s,prob,theta1,theta,xa,xb,xc,xd,t,delta) {
expo1=
2007 Oct 13
2
the use of the .C function
Dear All,
could someone please shed some light on the use of the .C or .Fortran function:
I am trying load and running on R the following function
// psi.cpp -- psi function for real arguments.
// Algorithms and coefficient values from "Computation of Special
// Functions", Zhang and Jin, John Wiley and Sons, 1996.
//
// (C) 2003, C. Bond. All rights reserved.
//
//
2010 Sep 28
2
cochran Q test
Dear all,
I am trying to look for a built in function that performs the cochran Q
test.
that is, cochranq.test(X)
where X is a contingency table (maybe a matrix or data.frame).
The output will naturally be the test statisitcs, p-value, etc.
A quick search on Google gives me the cochran.test in the 'outlier' package,
but I had a look at the description of the test and it doesn't look
2009 Mar 20
1
Mean-replacing NAs in a 3d array
Hi all
I have a 3d array containing missing values.
> Xa
, , 1
[,1] [,2]
[1,] 1 3
[2,] NA 4
, , 2
[,1] [,2]
[1,] 5 7
[2,] NA NA
, , 3
[,1] [,2]
[1,] 9 11
[2,] 10 12
I want to replace the missing values with the mean, but the mean of each
'page' in the array (wrong terminology I'm sure). So - for the array
above - [2,1,2] and
2011 Oct 10
4
correlation matrix
Hello Gurus
I have two correlation matrices 'xa' and 'xb'
set.seed(100)
d=cbind(x=rnorm(20)+1,
x1=rnorm(20)+1,
x2=rnorm(20)+1)
d1=cbind(x=rnorm(20)+2,
x1=rnorm(20)+2,
x2=rnorm(20)+2)
xa=cor(d,use='complete')
xb=cor(d1,use='complete')
I want to combine these two to get a third matrix which should have half
values from 'xa' and half
2006 Aug 02
1
RE
Hi any,
Can some please detail me the createX command in bayesm package?
To make things easy for you to help me, let me put forward my problem
Suppose I have 3 covariates (say X matrix) and my Y has 3 categories say
(1,2,3). Now from the CreateX I understand that the data matrix say 'Xa' must
be of dimension n* (naxp), where 'na' is the number of variables and 'p' is
2012 Jul 10
3
fill 0-row data.frame with 1 line of NAs
Dear all
Is there a simpler method to achieve the following: When I obtain an
empty data.frame after subsetting, I need for it to contain one line
of NAs. Here's a dummy example:
> (.xb <- iris[ iris$Species=='zz', ])
[1] Sepal.Length Sepal.Width Petal.Length Petal.Width Species
<0 rows> (or 0-length row.names)
> dim(.xb)
[1] 0 5
> (.xa <-
2012 Jun 21
4
convert 'character' vector containing mixed formats to 'Date'
Dear all
I have a 'character' vector containing mixed formats (thanks Excel!)
and I'd like to translate it into a default "%Y-%m-%d" Date vector.
x <- c("1/3/2005", "13/04/2004", "2/5/2005", "2/5/2005", "7/5/2007",
"22/04/2004", "21/04/2005", "20080430", "13/05/2003",
2012 Oct 13
1
hep on arithmetic covariance conversion to log-covariance
Dear All,
is there a function in R that would help me convert a covariance matrix built based on arithmetic returns to a covariance matrix from log-returns?
As an example of the means and covariance from arithmetic:
mu <-c(0.094,0.006,1.337,1.046,0.263)
sigma
2004 Mar 10
3
converting lists got by tapply to dataframes
I have two lists:
xa <- list( X=c(1,2,3), Y=c(4,5,6), Z=c(7,8,9) )
xb <- with( barley, tapply( X=seq(1:nrow(barley)), INDEX=site
, FUN=function(z)yield[z]))
I can convert xa to a dataframe easily with:
as.data.frame(xa)
But if i try the same with xb I get:
as.data.frame(xb)
Error in as.data.frame.default(xb) :
can't coerce array into a data.frame
What
2013 Jul 16
2
Problem following an R bug fix to integrate()
I have been told by the CRAN administrators that the following code generated
an error on 64-bit Fedora Linux (gcc, clang) and on Solaris machines (sparc,
x86), but runs well on all other systems):
> fn <- function(x, y) ifelse(x^2 + y^2 <= 1, 1 - x^2 - y^2, 0)
> tol <- 1.5e-8
> fy <- function(x) integrate(function(y) fn(x, y), 0, 1,
2011 Dec 07
4
bug in rank(), order(), is.unsorted() on character vector
Hi,
This looks OK:
> x <- c("_1_", "1_9", "2_9")
> rank(x)
[1] 1 2 3
But this does not:
> xa <- paste(x, "a", sep="")
> xa
[1] "_1_a" "1_9a" "2_9a"
> rank(xa)
[1] 2 1 3
Cheers,
H.
> sessionInfo()
R version 2.14.0 (2011-10-31)
Platform: x86_64-unknown-linux-gnu (64-bit)
locale:
[1]