Displaying 20 results from an estimated 27 matches for "mat1".

Did you mean:
mat

2013 Sep 02

3

Product of certain rows in a matrix

Hi,
You could try:
A<- matrix(unlist(read.table(text="
1 2 3
4 5 6
7 8 9
9 8 7
6 5 4
3 2 1
",sep="",header=FALSE)),ncol=3,byrow=FALSE,dimnames=NULL)
library(matrixStats)
?res1<-t(sapply(split(as.data.frame(A),as.numeric(gl(nrow(A),2,6))),colProds))
?res1
#? [,1] [,2] [,3]
#1??? 4?? 10?? 18
#2?? 63?? 64?? 63
#3?? 18?? 10??? 4

2013 Sep 26

1

Grouping Matrix by Columns; OHLC Data

HI,
May be this helps:
set.seed(24)
?mat1<- matrix(sample(1:60,30*24,replace=TRUE),ncol=24)
colnames(mat1)<- rep(c("O","H","L","C"),6)
indx<-seq_along(colnames(mat1))
n<- length(unique(colnames(mat1)))
?res<- lapply(split(indx,(indx-1)%%n+1),function(i) mat1[,i])
lapply(res,head,2)
#$`...

2013 Sep 27

3

Compare species presence and absence between sites

Dear List,
I want to compare the presence and absence of bird species based on the
sites in a matrix.
The matrix has 5 rows for Island A, B, C, D, and E.
It has 100 columns for bird species D001-D100.
In each cell of the matrix,
the presence-absence of bird species will be recorded as 1 or 0.
(For example, if species D001 is found on Island D,
the matrix cell of species D001 and Island D

2013 Mar 28

1

scatterplot3d with densCols ?

Hi,
I was trying to make a 3D plot using densCols. The documentation for
densCols doesn't look like it'll work for 3D. For example:
-----------------------------------------
library(scatterplot3d)
v1 <- rnorm(10000)
v2 <- rnorm(10000)
v3 <- rnorm(10000)
## 2D with denscols
mat1 <- cbind(v1,v2)
mcols1 <- densCols(mat1)
plot(mat1,col=mcols1)
mat <- cbind(v1,v2,v3)
mcols <- densCols(mat) ## No go?
## 3D version with no densCols parameter
scatterplot3d(mat,pch=16)
## gives error
scatterplot3d(mat,col=mcols,pch=16)
-----------------------------------------
Is...

2006 Aug 15

4

nls

Is there anyway to change any y[i] value (i=2,...6) to make following NLS workable?
x <- c(0,5,10,15,20,25,30)
y <- c(1.00000,0.82000,0.68000,0.64000,0.66667,0.68667,0.64000)
lm(1/y ~~ x)
nls(1/y ~~ a+b*x^c, start=list(a=1.16122,b=0.01565,c=1), trace=TRUE)
#0.0920573 : 1.16122 0.01565 1.00000
#Error in numericDeriv(form[[3]], names(ind), env) :
# Missing

2011 Aug 08

0

Odp: Fw: R function for Gage R&R

....sm.odch", "toler.sm.odch")
velik<-dim(result)[2]
names(result)<-meno[1:velik]
suma<-summary(fit)
kateg<-trunc(smodch[1]/smodch[6]*1.41)+1
if (plotit)
{
par(mfrow=c(3,2))
posice<-volvzor*1:volop
mat<-aggregate(vysledek,list(vzorek,operator),mean,na.rm=T)
mat1<-aggregate(vysledek,list(vzorek,operator),sd,na.rm=T)
#fig1
hmdm<-c(mean(mat$x)+(mean(mat1$x)/.9)/sqrt(opak)*3,
mean(mat$x)-(mean(mat1$x)/.9)/sqrt(opak)*3)
plot(mat$x,type="b",ylab="Prumery")
abline(h=mean(mat$x),col=3)
abline(h=h...

2008 Mar 05

1

coxme - fitting random treatment effect nested within centre

Dear all,
I am using "coxme" function in Kinship library to fit random treatment effect nested within centre. I got 3 treatments (0,1,2) and 3 centres. I used following commands, but got an error.
> ugroup=paste(rep(1:3,each=3),rep(0:2,3),sep='/')
> mat1=bdsmatrix(rep(c(1,1,1,1,1,1,1,1,1),3),blocksize=rep(3,3),dimnames=list(ugroup,ugroup))
> mat2=bdsmatrix(rep(c(0,0,0,0,0,0,0,0,1),3),blocksize=rep(3,3),dimnames=list(ugroup,ugroup))
> group=paste(dat1$centre,dat1$treat,sep='/')
> coxme(Surv(time,status) ~ as.factor(treat), data=...

2011 Aug 04

1

matrix rows to single numeric element

I have a matrix of 5 columns and 64 rows, let's call it "mat1". All values are 1 or 0. I need to take the values of the elements by row and create a single numeric element that can be placed its respective slot in a 64-element list, named "list1". For example, mat1[11,1:5] = 0,1,1,0,1 and I must put 01101, with a length of 1, into the 11th e...

2012 Oct 07

1

variances of random effects in coxme

...ckage coxme in order to build Cox
models with complex random effects. Unfortunately, I sometimes get
surprising estimations of the variances of the random effects.
I ran models with different fixed covariates but always with the same 3
random effects defined by the argument
varlist=coxmeMlist(list(mat1,mat2,mat3), rescale = F, pdcheck = F,
positive=F). I get a few times exactly the same estimations of the
parameters of the random effects whereas the fixed effects of the models
are different:
Random effects
Group Variable Std Dev Variance
idp Vmat.1 0.10000000 0.01000000
Vmat.2...

2013 Jun 18

1

eigen(symmetric=TRUE) for complex matrices

R-3.0.1 rev 62743, binary downloaded from CRAN just now; macosx 10.8.3
Hello,
eigen(symmetric=TRUE) behaves strangely when given complex matrices.
The following two lines define 'A', a 100x100 (real) symmetric matrix
which theoretical considerations [Bochner's theorem] show to be positive
definite:
jj <- matrix(0,100,100)
A <- exp(-0.1*(row(jj)-col(jj))^2)
A's being

2012 Dec 10

3

Warning message: In eval(expr, envir, enclos) : non-integer #successes in a binomial glm!

...the real data does return information about the coefficients and the model fitting.
I'm grateful for any help. I'm aware that the topic of non-integer successes has been addressed before, but I could not find my answer to this question.
Yours, Simon Kiss
######str() on original data
str(mat1)
'data.frame': 1001 obs. of 5 variables:
$ prov : Factor w/ 4 levels "Ontario","PQ",..: 2 2 2 2 2 2 2 2 2 2 ...
$ edu : Factor w/ 2 levels "secondary","post-secondary": 2 2 2 1 1 2 2 2 1 1 ...
$ gender: Factor w/ 2 levels "Male...

2009 Mar 25

1

Weighted Graph Link strength ( I am making mistake please help)

...Program to read and create Matrix
matrixmy<-scan("test.csv",sep=",",skip=1)
arr=array(0,dim=c(4,4))
a<-1
while(a<=length(matrixmy))
{
i=matrixmy[a]
a<-a+1
j=matrixmy[a]
a<-a+1
k=matrixmy[a]
arr[i,j]<-k
arr[j,i]<-k
a<-a+1
}
Created matrix
mat1<-matrix(data=arr,nrow=4,ncol=4)
g<-graph.adjacency(adjmatrix=mat1,mode=c("undirected"))
betweenness(g)
The answer I get is
0 0 0 0
I was expecting Node 1 will have high value.
Can someone tell me why it is happening like this.
Thanks in advance.
Nathna
--
View this mess...

2013 Jun 05

2

combining two different matrizes

Hello together,
this is ma first post, so please aplogize me if post this in the wrong
section.
I have problem concerning ma two matrizes.
After a regressione and so on, I got two matrizes
Matrixres contains the results of ma calculation.
Matrixr contains my detiene, which where Aldo used for the regression.
Please ser the following code:
#Datei einlesen
residual =

2011 Apr 24

2

random roundoff?

...multiplications, I have a situation in
in which the result depends on the nature of nearby I/O. Thus,
with all arithmetic done with type double, and where values
are mostly in the range [-1.0e0,+1.0e0] or nearby, I do:
cerr << "some stuff" << endl;
mat3 = matmult(mat1,mat2);
I get a difference of the order 1.0e-15 depending on whether the
cerr line does or does not end in "endl" as shown.
I am imagining that there is some "randomness" in the roundoff
that depends on the I/O situation. Is this credible? Any other
suggestions?
Thanks f...

2013 May 14

0

Matrix multiplication with scattered NA values

Hi,
Not sure if this is what you wanted:
?mat1<- as.matrix(read.table(text="
????? 33??????? 45??? 50
????? NA?????? NA?? 54
",sep="",header=FALSE))
mat2<- as.matrix(read.table(text="
24??????????????? 0.0000000??????? 0.0000000
0.0000000??????? 14??????????????? 0.0000000
0.0000000 0.0000000??????? 10
",sep=...

2012 Oct 09

1

Error in if (is.na(n) || n > 65536L) stop("size cannot be NA nor exceed 65536") : missing value where TRUE/FALSE needed

Dear useRs,
i am using NbClust to determine appropriate number of cluster for hclustering. i am consistently getting the following error
Error in if (is.na(n) || n > 65536L) stop("size cannot be NA nor exceed 65536") :
missing value where TRUE/FALSE needed
Does any one know where i am wrong??
thanks in advance
eliza
[[alternative HTML version deleted]]

2013 Nov 05

2

multi

[[1]]
[,1] [,2]
[1,] 0.003632559 0.2190629
[2,] -2.090772847 0.2190629
[[2]]
[,1] [,2]
[1,] 0.004278991 0.04337005
[2,] 0.190723602 0.04337005
[[3]]
[,1] [,2]
[1,] 0.01237827 -0.01544811
[2,] 0.06452200 -0.01544811
g<-c(1,2,3)
function(g,hessianList){
for(i in 1:3){
ft1<-g[2]*hessianList[[2]]
ft2<-sum(ft1)

2011 May 10

1

Weird read.xls behavior

Dear list,
I used read.xls to read in an excel file, which has both character and
numeric columns. Everything seems fine except in the last column, I have
this character value "ng/ml". When reading in, read.xls seems to add a space
at the end of it, became "ng/ml ". How can I prevent read.xls doing so?
Thanks.
>read.xls(data, header=T, as.is=T)
Jun
[[alternative

2011 Mar 30

1

VECM with UNRESTRICTED TREND

Dear All,
My question is:
how can I estimate VECM system with "unrestricted trend" (aka "case 5")
option as a deterministic term?
As far as I know, ca.jo in urca package allows for "restricted trend"
only [vecm
<- ca.jo(data, type = "trace"/"eigen", ecdet = "trend", K = n, spec =
"transitory"/"longrun")].

2009 Aug 10

2

strsplit a matrix

Dear all,
I am trying to split a matrix into 2 as efficiently as possible.
It is a character matrix:
1 2 3
1 "2-271" "2-367" "1-79"
2 "2-282" "2-378" "1-90"
3 "2-281" "2-377" "1-89"
I want to make 2 matrices from this, as succinctly and efficiently as
possible.
I've tried such