Displaying 20 results from an estimated 31 matches for "conj".
Did you mean:
conf
2010 Dec 25
2
predict.lrm vs. predict.glm (with newdata)
...all
I have run into a case where I don't understand why predict.lrm and
predict.glm don't yield the same results. My data look like this:
set.seed(1)
library(Design); ilogit <- function(x) { 1/(1+exp(-x)) }
ORDER <- factor(sample(c("mc-sc", "sc-mc"), 403, TRUE))
CONJ <- factor(sample(c("als", "bevor", "nachdem", "weil"), 403, TRUE))
LENGTH_DIFF <- sample(-32:25, 403, TRUE)
I fit two models:
model.01.lrm <- lrm(ORDER ~ CONJ*LENGTH_DIFF)
model.01.glm <- glm(ORDER ~ CONJ*LENGTH_DIFF, family=binomial)
Then I wan...
2010 Jul 30
4
transpose of complex matrices in R
Hello everybody
When one is working with complex matrices, "transpose" very nearly
always means
*Hermitian* transpose, that is, A[i,j] <- Conj(A[j,i]).
One often writes A^* for the Hermitian transpose.
I have only once seen a "real-life" case
where transposition does not occur simultaneously with complex conjugation.
And I'm not 100% sure that that wasn't a mistake.
Matlab and Octave sort of recognize this, as "A...
2008 Jul 25
1
transcript a matlab code in R
...aculty/shimotsu/ )
The Matlab code is
=======================================================================================
function[r] = whittle(d,x,m)
% WHITTLE.M computes the local Whittle likelihood, which uses
% the periodogram of data x accoding to the definition
%
% Ixx(k) = w(x)*conj(w(x)),
%
% where
% N
% w(k) = (2*pi*n)^(-1/2) sum x(t)*exp(i*2*pi*(k-1)*t/N), 1 <= k <=
N.
% t=1
%
% Katsumi Shimotsu, April 1999
%
% INPUT x: data (n*1 vector)...
2007 Nov 23
1
complex conjugates roots from polyroot?
Hi, All:
Is there a simple way to detect complex conjugates in the roots
returned by 'polyroot'? The obvious comparison of each root with the
complex conjugate of the next sometimes produces roundoff error, and I
don't know how to bound its magnitude:
(tst <- polyroot(c(1, -.6, .4)))
tst[-1]-Conj(tst[-2])
[1] 3.108624e-15+2.22045e...
2007 Feb 06
0
convolve: request for "usual" behaviour + some improvements + some fixes
...> > (no 'library', noR extension yet) contains definitions for 'fft', 'nextn'
> > and 'convolve' where the latter was (note the ":=" for what now
> > would be assignment to the base package)
> >
> > convolve := function (a, b, conj=F)
> > {
> > na <- length(a)
> > nb <- length(b)
> > n <- max(na, nb)
> > if (nb < n)
> > b <- c(b, rep(0, n - nb))
> > else if (na < n)
> > a <- c(b, rep(0, n - na))
> > da <- fft(a)
> > db <- fft(b)...
2007 Feb 02
1
Inaccuracy in ?convolve
Hi,
Man page for 'convolve' says:
conj: logical; if 'TRUE', take the complex _conjugate_ before
back-transforming (default, and used for usual convolution).
The complex conjugate of 'x', of 'y', of both?
In fact it seems that it takes the complex conjugate of 'y' only which
is OK but might be...
2003 Jul 03
2
SVD and spectral decompositions of a hermitian matrix
...value
decomposition. But when I put it back, I don't get the original
hermitian matrix. I am having the same problem with spectral value
decomposition as well.
I am using R 1.7.0 on Windows. Here is my code:
X <- matrix(rnorm(16)+1i*rnorm(16),4)
X <- X + t(X)
X[upper.tri(X)] <- Conj(X[upper.tri(X)])
Y <- La.svd(X)
Y$u %*% diag(Y$d) %*% t(Y$v) # this doesn't give back X
Y$u %*% diag(Y$d) %*% Y$v # this works fine.
Z <- La.eigen(X) # the eigen values should be real, but are not.
Z$vec %*% diag(Z$val) %*% t(Z$vec) # this doesn't give back X
The help for...
2009 Aug 09
1
Inaccuracy in svd() with R ubuntu package
...) results are correct with the ubuntu packaged R
as well as with R compiled on the machine.
The error seems not to arise, at least sometimes, with simple 2x2
complex matrices. To check for the error, run the following:
a <- matrix(rnorm(16) + rnorm(16)*1i, 4)
b <- svd(a)
with(b, u %*% t(Conj(u)))
The result should be an identity matrix, by the definition of the
singular value decomposition.
Below are example runs, first on the 64-bit system where results are
correct, then on one of the 32-bit systems.
> version
_
platform x86_64-p...
2013 Jan 07
0
Something wrong with echo_diagnostic.m
...e, play_file, out_file, tail_length)
F=fopen(rec_file,'rb');
rec=fread(F,Inf,'short');
fclose (F);
F=fopen(play_file,'rb');
play=fread(F,Inf,'short');
fclose (F);
rec = [rec; zeros(1024,1)];
play = [play; zeros(1024,1)];
N = length(rec);
corr = real(ifft(fft(rec).*conj(fft(play))));
acorr = real(ifft(fft(play).*conj(fft(play))));
[a,b] = max(corr);
if b > N/2
b = b-N;
end
printf ("Far end to near end delay is %d samples\n", b);
if (b > .3*tail_length)
printf ('This is too much delay, try delaying the far-end signal
a bit\n'...
2007 Dec 19
1
strange timings in convolve(x,y,type="open")
...noise.
The convolve function is not very big (see below). When type is
not specified, it defaults to "circular". So my guess is that something
mysterious might be happening inside the first else clause below,
at least on some architectures.
-Art Owen
> convolve
function (x, y, conj = TRUE, type = c("circular", "open", "filter"))
{
type <- match.arg(type)
n <- length(x)
ny <- length(y)
Real <- is.numeric(x) && is.numeric(y)
if (type == "circular") {
if (ny != n)
stop("lengt...
2005 Sep 09
2
two almost identical packages: best practice
...unctions are applicable to objects of
class "quaternion".
So, for example, I have a generic function Im.octonion():
R> Im.octonion
function (x)
{
Re(x) <- 0
return(x)
}
The definition of Im.quaternion() is exactly the same.
Sometimes the return value is an octonion:
Conj.octonion
function (x)
{
x <- as.matrix(x)
x[-1, ] <- -x[-1, ]
return(as.octonion(x))
}
So the last line of Conj.quaternion() would be "return(as.quaternion
(x))"
but would be otherwise identical.
A similar story holds for each of maybe twenty generic functions.
Near...
2005 Aug 12
3
General expression of a unitary matrix
Hi, all,
Does anybody got the most general expression of a unitary matrix?
I found one in the book, four entries of the matrix are:
(cos\theta) exp(j\alpha); -(sin\theta)exp(j(\alpha-\Omega));
(sin\theta)exp(j(\beta+\Omega)); (cos\theta) exp(j\beta);
where "j" is for complex.
However, since for any two unitary matrices, their product should also
be a unitary matrix. When I
2004 Feb 18
1
Complex conjugate?
Is there a function in R that returns the complex conjugate of a matrix
(a la 'CONJ' in IDL or 'Conjugate' in Mathmatica)?
2010 May 30
1
Calling fft from C
...code is do_fft in Internals.h - but how
do I use do_fft? Or should I call another C routine (and how)?
How do I solve the problem in the most appropriate way?
convolve2=function2(x,y)
{
x<- c(rep.int(0,exp.length-1),x)
n <- length(y<-c(y, rep.int(0, irf.length -1)))
x <- fft(fft(x) * Conj(fft(y)), inverse=TRUE)
return(Re(x)/n)
}
--
Best wishes/bedste hilsner
Gunnar Hellmund
cand. scient., PhD
http://staff.pubhealth.ku.dk/~guhe/
---
?If everyone is thinking alike, then somebody isn't thinking.?
2000 Jan 28
0
convolution bug (PR#408)
Full_Name: Bill Simpson
Version: 65.1 , 0.90.1
OS: Linux
Submission from: (NULL) (193.62.250.209)
I reported this on r-help, but here is official bug report.
The present convolve() does not do convolution by default. Its default behaviour
is
correlation. This is a bug.
The default argument conj should be set to FALSE.
The zero-padding should be on the right for linear convolution (don't ask me
why you call this type="open"; I suggest type="linear").
Here is what I expect linear convolution to do:
myconvolve<-function (x,h)
{
nx <- length(x)
nh <...
2010 May 05
1
testInstalledBasic question
...amp;"
"*" "+"
[8] "-" "/" "<" "<=" "=="
">" ">="
[15] "Arg" "Conj" "Im" "Mod" "Re"
"^" "abs"
[22] "acos" "acosh" "all" "any"
"as.character" "as.complex" "...
2002 Jul 25
3
Barplot coloring question
Hi all,
I have the following dataset, call it test.data (30 columns, and one row
named "0"):
ADVP ADVP AP AP CONJ CONJ CP CP DU DU INF INF MWU
MWU NP NP PP PP PPRT PPRT REL REL SMN SMN SSB SSB SV1
SV1 TI TI
0 96.85 2.05 89.07 2.54 70.91 2.37 94.92 3.46 82.31 11.33 40.96 2.25 98.06
3.43 90.77 17.63 86.60 10.78 60.27 1.32 93.27 0.97 77.60 12.46 64.98 3.32
88.54 3.70 24.33 0....
2005 Jul 29
1
octonions
...make octonion matrices multiply as they should,
in the same way that (eg) complex matrices do.
Perhaps we could define "*" and "/" appropriately for vectors of class
"octonion" (if such a thing makes sense): or is there a better
way? Also, Mod(), Re(), and perhaps
Conj() would have to be generalized to work with octonions.
comments please!
--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
tel 023-8059-7743
2002 Apr 10
1
Layout of Fourier frequencies
I'm doing convolutions in the frequency domain and need to know the
layout of the Fourier modes returned by fft. (This is leading up to a
more involved question about moment generating functions, but I need to
know if I've got this part correct first.)
I think in 1D the pattern is:
0 1 2 3 -2 1 (even)
0 1 2 3 -3 2 1 (odd)
In 2D is it simply (for a square matrix):
0 1 2 -1 (horizontal)
1999 Nov 18
1
convolve bug?
...quot;o")
[1] 4 6 10 11 14 7 4
I think "open" is the right type. I want to get length(x)+length(h)-1
terms in the convolution output, which is what "open" gives. I definitely
don't want "circular"
BTW, the help for convolve says:
If `r <- convolve(x,y, conj=TRUE, type)' and `n <-
length(x)', then
r[k] = sum(i=1,..,n; x[i] * y[k-i])
for k = 1,...,n.
There seems to be a typo: shouldn't it be
r <- convolve(x,y, conj=TRUE, type="open") or "filter" or whatever
2.
x<-seq(1,100)
y...