Displaying 20 results from an estimated 7000 matches similar to: "as.complex()"
2008 Jul 11
1
Comparing complex numbers
Is there an easy way to compare complex numbers?
Here is a small example:
> (z1=polyroot(c(1,-.4,-.45)))
[1] 1.111111-0i -2.000000+0i
> (z2=polyroot(c(1,1,.25)))
[1] -2+0i -2+0i
> x=0
> if(any(identical(z1,z2))) x=99
> x
[1] 0
# real and imaginary parts:
> Re(z1); Im(z1)
[1] 1.111111 -2.000000
[1] -8.4968e-21 8.4968e-21
> Re(z2); Im(z2)
[1] -2
2011 Feb 22
1
regsubsets {leaps}
Hi,
I'd like to run regsubsets for model selection by exhaustive search. I have
a list with 20 potential explanatory variables, which represent the real and
the imaginary parts of 10 "kinds" of complex numbers:
x <- list(r1=r1, r2=r2, r3=r3, ..., r10=r10, i1=i1, i2=i2, i3=i3, ...,
i10=i10)
Is there an easy way to constrain the model search so that "r"s and
2008 Mar 12
4
Distances between two datasets of x and y co-ordinates
Hi all
I am trying to determine the distances between two datasets of x and y
points. The number of points in dataset One is very small i.e. perhaps
5-10. The number of points in dataset Two is likely to be very large
i.e. 20,000-30,000. My initial approach was to append the first dataset
to the second and then carry out the calculation:
dists <- as.matrix(dist(gis data from 2 * datasets))
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-16i
2006 Jul 08
2
String mathematical function to R-function
hello
I make a subroutine that give-me a (mathematical)
function in string format.
I would like transform this string into function ( R
function ).
thanks for any tips.
cleber
#e.g.
fun_String = "-100*x1 + 0*x2 + 100*x3"
fun <- function(x1,x2,x3){
return(
############
evaluation( fun_String )
############
)
True String mathematical function :-( :-(
> nomes
[1]
2009 Nov 09
3
How to transform the Matrix into the way I want it ???
Hi, R users,
I'm trying to transform a matrix A into B (see below). Anyone knows how to
do it in R? Thanks.
Matrix A (zone to zone travel time)
zone z1 z2 z3 z1 0 2.9 4.3 z2 2.9 0 2.5 z3 4.3 2.5 0
B:
from to time z1 z1 0 z1 z2 2.9 z1 z3 4.3 z2 z1 2.9 z2 z2 0 z2 z3 2.5 z3 z1
4.3 z3 z2 2.5 z3 z3 0
The real matrix I have is much larger, with more than 2000 zones. But I
think it should
2011 Mar 29
5
Integration with variable bounds
If this is posted elsewhere I cannot find it. I need to perform multiple
integration where some of the variables are in the bounds of the other
variables. I was trying to use R2Cuba function but cannot set the upper and
lower bounds. My code so far is :
int <- function(y){
u2 = y[1]
z2 = y[2]
u1 =y[3]
z1 = y[4]
ff <- u1*(z1-u1)*u2*(z2-u2)*exp(-0.027*(12-z2))
return(ff)
}
2012 Aug 08
3
help, please! matrix operations inside 3 nested loops
hello, this is my script:
#1) read in data:
daten<-read.table('K:/Analysen/STRUCTURE/input_STRUCTURE_tab_excl_5_282_559.txt',
header=TRUE, sep="\t")
daten<-as.matrix(daten)
#2) create empty matrix:
indxind<-matrix(nrow=617, ncol=617)
indxind[1:20,1:19]
#3) compare cells to each other, score:
for (s in 3:34) { #walks though the matrix colum by colum, starting at
2006 Jun 15
3
matrix selection return types
Dear Rusers,
I would like some comments about the following results
(under R-2.2.0)
> m = matrix(1:6 , 2 , 3)
> m
[,1] [,2] [,3]
[1,] 1 3 5
[2,] 2 4 6
> z1 = m[(m[,1]==2),]
> z1
[1] 2 4 6
> is.matrix(z1)
[1] FALSE
> z2 = m[(m[,1]==0),]
> z2
[,1] [,2] [,3]
> is.matrix(z2)
[1] TRUE
Considered together, I'm a bit surprised about
2002 Mar 27
2
Error with nls
Dear R-group members,
I use:
platform i386-pc-mingw32
arch x86
os Win32
system x86, Win32
status
major 1
minor 4.1
year 2002
month 01
day 30
language R
I try to fit a 2 compartment model. The compartments are open, connected
to each other and
2008 Oct 04
3
How to plot countours with fixted densities?
Hello,
I used the following codes to generate bivariate normal dependence structure with unit Frechet margins.
Sigma <- matrix(c(1,.5*sqrt(1),.5*sqrt(1),1),2,2) # generate
y <- mvrnorm(Nsam, c(0,0), Sigma) # random
v <- cbind(pnorm(y[,1],mean = 0, sd = 1), pnorm(y[,2],mean = 0, sd = 1))
z <- cbind(-1/log(v[,1]),-1/log(v[,2]))
z1 <- z[,1]
z2 <- z[,2]
And to
2013 Oct 18
1
crr question in library(cmprsk)
Hi all
I do not understand why I am getting the following error message. Can
anybody help me with this? Thanks in advance.
install.packages("cmprsk")
library(cmprsk)
result1 <-crr(ftime, fstatus, cov1, failcode=1, cencode=0 )
one.pout1 = predict(result1,cov1,X=cbind(1,one.z1,one.z2))
predict.crr(result1,cov1,X=cbind(1,one.z1,one.z2))
Error: could not find function
2017 Jul 28
3
problem with "unique" function
I have the joint distribution of three discrete random variables z1, z2 and
z3 which is captured by "z"
and "prob" as described below.
For example, the probability for z1=0.46667, z2=-1 and z3=-1 is 2.752e-13.
Also, the probability adds up to 1.
> head(z) z1 z2 z3
[1,] -0.46667 -1.0000 -1.0000
[2,] -0.33333 -0.9333 -0.9333
[3,] -0.20000 -0.8667 -0.8667
2006 Jun 14
3
A question about stepwise procedures: step function
Dear all,
I tried to use "step" function to do model selection, but I got an error massage. What I don't understand is that data as data.frame worked well for my other programs, how come I cannot make it run this time. Could you please tell me how I can fix it?
***************************************************************************************************
2006 Mar 16
2
Using of LME function in non-replicate data
Hello all R-users!
In Jun-2005, I find the follow discussion about using
of
LME function ( in NLME library ) for fitting
non-replicate data
The thread: ANOVA vs REML approach to variance
component estimation
http://tolstoy.newcastle.edu.au/R/help/05/06/6498.html
Someone expose the follow problem:
# non-replicate data
y <- c(2.2, -1.4, -0.5, -0.3, -2.1, 1.5, 1.3, -0.3,
0.5, -1.4,
2008 Apr 03
3
summary(object, test=c("Roy", "Wilks", "Pillai", ....) AND ellipse(object, center=....)
Dear All,
I would be very appreciative of your help with the following
1). I am running multivariate multiple regression through the manova() function (kindly suggested by Professor Venables) and getting two different answers for test=c("Wilks","Roy","Pillai") and tests=c("Wilks","Roy",'"Pillai") as shown below. In the
2006 Jan 27
1
about lm restrictions...
Hello all R-users
_question 1_
I need to make a statistical model and respective ANOVA table
but I get distinct results for
the T-test (in summary(lm.object) function) and
the F-test (in anova(lm.object) )
shouldn't this two approach give me the same result, i.e
to indicate the same significants terms in both tests???????
obs.
The system has two restrictions:
1) sum( x_i ) = 1
2) sum(
2005 Jun 02
4
plot/lm/abline
Hi,
when I run
> plot.default(z1, z2, xlab = "x", ylab = "y", main = "xxxx", pch = "+")
> abline(lm(z1 ~ z2))
then the plot is plotted perfectly (scatterplot), however, the lm()
function doesnt appear on the plot. What could be wrong?
(Yesterday it worked perfectly, with the lm() line.)
Running R 2 on OS X.
Mathias Hunsk??r Furevik
Norway
2004 Mar 10
1
Shorewall2 - Action commands
Dear All,
I have read all the documentation I can find but I still have not understood how, in what context and where to use the action commands enumerated in /usr/share/shorewall/actions.std.
Illustrating with SMB traffic for instance, how can one use AllowSMB, DropSMB and RejectSMB to control SMB traffic instead of the classic
ACCEPT z1 z2 udp 135,445
ACCEPT z1
2010 Jan 29
1
use zoo package with multiple column data sets
Readers,
I am trying to use the zoo package with an array of data:
file1:
hh:mm:ss 1
hh:mm:ss 2
hh:mm:ss 3
hh:mm:ss 4
file2:
hh:mm:ss 11 55
hh:mm:ss 22 66
hh:mm:ss 33 77
hh:mm:ss 44 88
I wanted to merge these data set so I tried the following commands:
library(chron)
library(zoo)
z1<-read.zoo("path/to/file1.csv",header=TRUE,sep=",",FUN=times)