search for: cormatrix

Displaying 20 results from an estimated 24 matches for "cormatrix".

2006 Nov 20
1
My own correlation structure with nlme
Dear all, I am trying to define my own corStruct which is different from the classical one available in nlme. The structure of this correlation is given below. I am wondering to know how to continue with this structure by using specific functions (corMatrix, getCovariate, Initialize,...) in order to get a structure like corAR1, corSymm which will be working for my data. Thanks in advance. Regards M. Feddag *Correlation structure _ _* pairCorr <- function(A, B, lowerTriangle = TRUE){ n <- length(A) m <- length(B) if (n != m) s...
2007 Oct 10
2
corMatrix crashes with corARMA structure (PR#9952)
...ipley informs me the segfault is in corStruct.c Code to reproduce: n <- 100 # example from Box and Jenkins p. 83 arcoefs <- c(0.8) macoefs <- c(-0.6) p <- length(arcoefs) q <- length(macoefs) require(nlme) tmp <- corARMA(value=c(arcoefs,macoefs), form=~1, p=p, q=q) Sigma <- corMatrix(tmp, covariate = 1:n) # segfault
2007 Oct 01
1
corMatrix crashes R 2.5.1 (windows XP) with corARMA structure
R-helpers, n <- 100 arcoefs <- c(0.8) macoefs <- c(-0.6) p <- length(arcoefs) q <- length(macoefs) require(nlme) tmp <- corARMA(value=c(arcoefs,macoefs), form=~1, p=p, q=q) Sigma <- corMatrix(tmp, covariate = 1:n) # results in segfault Have I used these commands in an improper way? Thanks Ben
2009 May 01
1
computationally singular and lack of variance parameters in SEM
...ur observed variables with 20 observations each, I hope this is correct. I have attached the path diagram for my model as a jpeg. My R code is the following: data<-read.table("ChamelaColonySize.csv",header=TRUE,sep=",") attach(data) cor(data,method="spearman") CorMatrix<-matrix(c( + 1, 0, 0, 0, + -0.4974, 1, 0, 0, + -0.4403, 0.7965, 1, 0, + 0.1250, 0.2602, 0.1825, 1),ncol=4,byrow=T) rownames(CorMatrix)<-colnames(CorMatrix)<-c('Herbivory','Ants','Coccoids', 'Space') ramcor<-specify.model() Coccoids<->Ants, ga...
2005 Oct 31
2
nlme error message
Dear Friends, I am seeking for any help on an error message in lme functions. I use mixed model to analyze a data with compound symmetric correlation structure. But I get an error message: "Error in corMatrix.corCompSymm(object) : NA/NaN/Inf in foreign function call (arg 1)". If I change the correlation structure to corAR1, then no error. I have no clue how to solve this problem. I would highly appreciate any help. Thanks in advance and looking forward to any help. JY I attached my data and...
2012 May 02
3
Consulta gráfica
  Hola,   Por favor, ¿podríais indicarme qué recursos (librerías o ideas) pueden resultar de utilidad para crear un gráfico del estilo del de la figura 3.8 del siguiente link?   http://www.tsc.uvigo.es/BIO/Bioing/ChrLDoc3.html#3.5   Actualmente estoy utilizando funciones muy básicas y la verdad es que no me encuentro muy satisfecha con el resultado.   Muchas gracias.   Eva [[alternative HTML
2010 Apr 14
1
creating a new corClass for lme()
...) return(object) } Initialize.corSPT <- function(object,...) { object <- list("time"=Initialize(object[["time"]],...),"space"=Initialize(object[["space"]],...)) class(object) <- c("corSPT","corStruct") return(object) } corMatrix.corSPT <- function(object,covariate = NULL, ...) { a <- corMatrix(object[["time"]],covariate=getCovariate(object[["time"]]),...) b <- corMatrix(object[["space"]],covariate=getCovariate(object[["space"]]),...) lapply(seq(length(a)),function(n) p...
2013 May 17
2
peering inside functions in a package?
Let's say I would like to look inside the function corBrownian in library (ape). When I type in the function name I get the following, which is not nearly the detail that goes into this function. I am wondering how to begin cracking this function open (and others) so I can learn more about it and perhaps code my own corClass one day. Thanks. > corBrownian function (value = 1, phy, form
2011 Jan 11
1
Postscript function Bug at R x64 2.12.1?
...cutpoints = c(0, 0.001, 0.01, 0.05, 0.1, 1), symbols = c("***", "**", "*", ".", " ")) text(0.5, 0.5, txt, cex = cex * r) text(.8, .8, Signif, cex=cex, col=2) } # Saving the Graphics postscript('CorMatrix.eps',paper='special',onefile=F,horizontal=F,bg='white' ,width=7,height=7,pointsize=9) # Here the issue pops up par(pty='m') pairs(Grupos[,-7],lower.panel=panel.smooth,upper.panel=panel.cor) dev.off() png('CorMatrix.png',bg='white',width=2800,height...
2005 Mar 22
2
LME correlation structures: user defined
Let me modify my question about user-defined covariance structures for LME models: Can somebody tell me how I can see the code for the definition of the correlation structures that come with the NLME package. Specifically I like to see the code for the functions coef, corMatrix, and intialize for any of the pre-defined correlation structures, and use this as a template to define a new correlation structure. So how do I see e.g. the code for the method initialize for the correlation structure corExp or corARMA? thank you in advance! Michael Jerosch-Herold PS: Oh, and if...
2012 May 29
1
correlation matrix only if enough non-NA values
...ssing data in the column (in the example, at least 5 non NA values out of 10). table <- data.frame(ST1_capt1=rnorm(1:10),ST1_capt2=c(1,2,3,4,NA,NA,7:9,NA), ST2_capt1=c(NA,NA,NA,NA,NA,6:10),ST2_capt2=c(21,NA,NA,NA,25:30), ST3_capt1=c(1,NA,NA,4:10),ST3_capt2=c(NA,NA,NA,NA,NA,NA,NA,NA,NA,NA)) cormatrix <- cor(table[,c(1,3,5)],use="pairwise.complete.obs") To solve this problem, I think it would be useful to use a code like this before calculating the correlation matrix: if(sum(!is.na(table[1:10,])) >=5) then calculate the correlation coefficient, and else (if less than 5 non-NA...
2017 May 10
2
bug report: nlme model-fitting crashes with R 3.4.0
...+ Sex, data = Orthodont, random = ~ 1|Subject) # Error in array(c(rep(1, p), .C(inner_perc_table, as.double(X), as.integer(unlist(grps)), : # object 'inner_perc_table' not found gls(distance ~ age + Sex, data = Orthodont, correlation = corCompSymm( form = ~ 1 | Subject)) # Error in corMatrix.corCompSymm(object) : # object 'compSymm_matList' not found # #Upon debugging, the error is thrown by line 60 of gls code # #glsSt <- Initialize(glsSt, dataMod, glsEstControl) R.version # _ # platform x86_64-w64-mingw32 # arch x86_64 # os mingw32 # system...
2005 Mar 16
0
user-defined correlation structure in NLME
...Specifically, I want to define a Toeplitz type correlation structure, but due to my inexperience with programming in R, I feel a bit overwhelmed with the task at hand. I understand that you can start with a function like corAR1 as template, but I have no idea how I would define the methods (coef, corMatrix, and initialize) in this context. I did a search on Google and in the R-help archives, but have not found much in terms of hints and specific examples for user defined correlation structures. Thank you in advance! Michael Jerosch-Herold
2006 Feb 06
1
question about corStruct
dear list, I am wondering if one can find examples and/or more detailed descriptions of modifications needed when going beyond standard corStruct classes (i.e. those already provided for use in lme/nlme)? When I looked at pages 238-239 of Pinheiro/Bates (2000): Mixed-effects models in S and S-plus, I found that I would need a bit more explicit guidance what to do for implementing a new
2008 Feb 08
0
User-specified correlation structure (e.g., 2-banded Toeplitz)
...e matrix below contains INITIAL values). ---------------------Start R-code & output ------------------------------- #This intilizes a 2-banded Toeplitz structure cs1ARMA <- corARMA(value = c(0,-.3), form = ~ 1 | Subject, p = 2, q = 0) cs1ARMA <- Initialize(cs1ARMA, data = Orthodont) corMatrix(cs1ARMA)$M01 [,1] [,2] [,3] [,4] [1,] 1.0 0.0 -0.3 0.0 [2,] 0.0 1.0 0.0 -0.3 [3,] -0.3 0.0 1.0 0.0 [4,] 0.0 -0.3 0.0 1.0 > TOEP2 <- gls(distance ~ Sex * I(age - 11), Orthodont, + correlation = corARMA(value = c(0,-.3), form = ~ 1 | Subject, p = 2, q = 0),...
2008 Feb 08
0
User specified correlation structure (e.g., 2-banded Toeplitz)
...e matrix below contains INITIAL values). ---------------------Start R-code & output ------------------------------- #This intilizes a 2-banded Toeplitz structure cs1ARMA <- corARMA(value = c(0,-.3), form = ~ 1 | Subject, p = 2, q = 0) cs1ARMA <- Initialize(cs1ARMA, data = Orthodont) corMatrix(cs1ARMA)$M01 [,1] [,2] [,3] [,4] [1,] 1.0 0.0 -0.3 0.0 [2,] 0.0 1.0 0.0 -0.3 [3,] -0.3 0.0 1.0 0.0 [4,] 0.0 -0.3 0.0 1.0 > TOEP2 <- gls(distance ~ Sex * I(age - 11), Orthodont, + correlation = corARMA(value = c(0,-.3), form = ~ 1 | Subject, p = 2, q = 0),...
2008 Feb 12
0
nlme & special case of corARMA?
...e matrix below contains INITIAL values). ---------------------Start R-code & output ------------------------------- #This intilizes a 2-banded Toeplitz structure cs1ARMA <- corARMA(value = c(0,-.3), form = ~ 1 | Subject, p = 2, q = 0) cs1ARMA <- Initialize(cs1ARMA, data = Orthodont) corMatrix(cs1ARMA)$M01 [,1] [,2] [,3] [,4] [1,] 1.0 0.0 -0.3 0.0 [2,] 0.0 1.0 0.0 -0.3 [3,] -0.3 0.0 1.0 0.0 [4,] 0.0 -0.3 0.0 1.0 > TOEP2 <- gls(distance ~ Sex * I(age - 11), Orthodont, + correlation = corARMA(value = c(0,-.3), + form = ~ 1 | Sub...
2012 Jun 12
0
Specifying spatial correlation Form in nmle
...in ArcGIS for each land parcel and used them in the correlation form like this: test.exp<-corExp(1, form = ~ X + Y) test.exp<- Initialize(test.exp,dataset) However, the correlation Matrix generated does not look right. Here is a portion of the matrix, in which all correlations are 0: > corMatrix(pdxspc.exp)[1:5, 1:5] [,1] [,2] [,3] [,4] [,5] [1,] 1 0 0 0 0 [2,] 0 1 0 0 0 [3,] 0 0 1 0 0 [4,] 0 0 0 1 0 [5,] 0 0 0 0 1 It seems I'm not using the X Y coordinates correctly in the form. I saw two examples that u...
2017 May 11
0
bug report: nlme model-fitting crashes with R 3.4.0
...|Subject) > > # Error in array(c(rep(1, p), .C(inner_perc_table, as.double(X), as.integer(unlist(grps)), : > # object 'inner_perc_table' not found > > gls(distance ~ age + Sex, data = Orthodont, > correlation = corCompSymm( form = ~ 1 | Subject)) > > # Error in corMatrix.corCompSymm(object) : > # object 'compSymm_matList' not found > # > #Upon debugging, the error is thrown by line 60 of gls code > # > #glsSt <- Initialize(glsSt, dataMod, glsEstControl) > > R.version > > # _ > # platform x86_64-w64-mingw32 > # arch...
2007 Apr 11
0
Error with corCompSymm and lme fit for repeated measures
...st NA 71 7 F s4 2.5m august 10.27613353 72 7 F s4 5.0m august 7.34681883 > lme1 = lme(y ~ M*D*Time, random=~1|Block/M/D/Time, data=PhotoRed, na.action=na.omit) > lme2 = update(lme1, correlation=corAR1()) > lme3 = update(lme1, correlation=corCompSymm()) Error in corMatrix.corCompSymm(object) : NA/NaN/Inf in foreign function call (arg 1) > cs = corCompSymm(value=0.5,form=~1|TreeID) > lme3 = update(lme1, correlation=cs) Error in lme.formula(fixed = y ~ M * D * Time, data = PhotoRed, random = ~1 | : Incompatible formulas for groups in "random" and &q...