search for: vmat

Displaying 13 results from an estimated 13 matches for "vmat".

Did you mean: vma
2004 Dec 21
3
R code for var-cov matrix given variances and correlations
...and the vector of correlations were cor.vec <- c(.4, .2, .5), then the vector of covariances would be: > covAB(c(.4, .2, .5),c(14, 14, 12), c(12, 7, 7)) [1] 5.184593 1.979899 4.582576 > and the variance-covariance matrix with covariances rounded to the first decimal place would be: > vmat <- matrix(c(14, 5.2, 2.0, 5.2, 12, 4.6, 2.0, 4.6, 7), + nrow=3) > vmat [,1] [,2] [,3] [1,] 14.0 5.2 2.0 [2,] 5.2 12.0 4.6 [3,] 2.0 4.6 7.0 > So the question is: How can I generate a p*p variance-covariance matrix from a vector of variances and a vector of correlations without...
2010 Dec 08
2
problem accessing complex list data frames
Hi all. I am currently attempting to build a list of sparse matrixes. That I have already achieved, by > vmat <- list() > for (i in 1:n) { > vmat <- c(vmat, sparseMatrix(i,j,x=data) > } How I am trying to select those elements from the list where the column e.g. 999 is not null. I can do this for one of the sparse matrices with > which(vmat[[1]][,999] != 0) which returns the rows whe...
2012 Oct 10
7
multiple t-tests across similar variable names
Hi everyone- I have a dataset with multiple "pre" and "post" variables I want to compare. The variables are named "apple_pre" or "pre_banana" with the corresponding post variables named "apple_post" or "post_banana". The variables are in no particular order. apple_pre orange_pre orange_post pre_banana apple_post post_banana person_1
2005 Oct 10
1
text(x,y,greek character)
...ters alpha or beta. I have tried to get the routine to plot a greek character with expression() or with substitute() and have not yet had any success. The following only plots the word in english in plain text. Here is my subroutine and data: --------------------------------------------------- vmat<-as.matrix(read.table("vmat")) Xm<-vmat[1:22,1:20] hemd<-read.table("threehem",header=T) Ym<-as.matrix(hemd[,2]) gvdw.pls<-plsr(Ym ~ Xm,6,method="kernelpls") rsltv<-predict(gvdw.pls,comps=6) plot(Ym,rsltv,type="n",xlab="Actividad + Bio...
2012 Oct 07
1
variances of random effects in coxme
...ed 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 0.02236068 0.00050000 Vmat.3 0.02449490 0.00060000 The variances are round figures, so I have the feeling that the algorithm didn't succeed in fitting the model. Has anyone ever faced to this problem? Thanks, Hugo [[alternative HTML versi...
2006 Apr 29
1
SSPIR problem
..., x, phi) { + FM <- mat + cat("Fmat", dim(FM), "\n") + FM + }, + Gmat = function(tt, x, phi) { + GM <- mat + cat("Gmat", dim(GM), "\n") + GM + }, + Vmat = function(tt, x, phi) { + VM <- mat + cat("Vmat", dim(VM), "\n") + VM + }, # var observation equation + Wmat = function(tt, x, phi) { + WM <- mat + cat("Wmat", dim(WM), "\n") +...
2013 Mar 27
0
Setting up a model in package dlm()
...this point. Any assistance would be greatly appreciated: Example code: #n x p output matrix FMat<-cbind(rnorm(123),rnorm(123)) #p x p state transition matrix GMat<-matrix(c(1,0,0,1),ncol=2) #p x p system noise distribution WMat<-matrix(c(0.02,0,0,0.02),ncol=2) # nxn measurement noise Vmat<-matrix(0,ncol=123,nrow=123) diag(Vmat)<-0.02 #initial state mean and variance m0Vec<-c(1,1) c0Vec<-c(0.05,0.05) ssMod<-dlm(FF=FMat,V=Vmat,GG=GMat,W=WMat,m0=m0Vec,C0=c0Vec) Resulting error: Error in dlm(FF = FMat, V = Vmat, GG = GMat, W = WMat, m0 = m0Vec, C0 = c0Vec) : Incompat...
2010 Sep 22
1
Newey West and Singular Matrix
...ction, and obs 5 is missing, then the AR term on ## 4 and 6 could be set to 0. right now, we just adjust for an add'l ## term. maskmatrix <- diagband.matrix( length(r.na.omitted), ar.terms ) resid.matrix <- full * maskmatrix } invx.x <- invx %*% t(x.na.omitted) vmat <- invx.x %*% resid.matrix %*% t(invx.x) sqrt(diag(vmat)) }
2010 Sep 23
1
Newey West and Singular Matrix + library(sandwich)
...6 could be set to 0. ?right now, we just adjust for an add'l >> ? ## term. >> >> ? maskmatrix <- diagband.matrix( length(r.na.omitted), ar.terms ) >> ? resid.matrix <- full * maskmatrix >> ?} >> >> ?invx.x <- invx %*% t(x.na.omitted) >> ?vmat <- ?invx.x %*% resid.matrix %*% t(invx.x) >> ?sqrt(diag(vmat)) >> } >> >> ______________________________________________ >> R-help at r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >>...
2006 Jun 15
1
SSPIR problem
Dear R-Users, I'm using SSPIR package for a spatio-temporal application. Is it possible to modify the structure of the involved matrixes (Fmat, Gmat, Vmat,Wmat)? I want to create a model like this #y(t)=k*theta(t)+epsilon(t) #theta(t)=h*theta(t-1)+eta(t) #epsilon(t) N(0,V) V=sigma2*I #eta(t) N(0,W) W=sigma2_eta where the state variable theta has dimension 1(p=1) and at each time time the observed variable y has dimension equal to...
2012 Aug 01
3
help with a regression problem
Hello, I have a big data frame where consecutive time dates and corresponding observed values for each subject (ID) are on a line. I want to compute the linear slope for each subject. I would like to use apply but I do not know how to express the corresponding function. An example using a loop follows # # create dummy data set There are missing values a <- c(1,2,3,4, 1,1,1,1, 2,2,3,3,
2010 Aug 24
0
Using kfilter in package sspir - dimensions do not agree
...]^3)/2,x[[1]][tt]^2,(x[[1]][tt]^3)/2,x[[1]][tt]^2) mat <- rbind(row.1,row.2,row.1,row.2) # no need for as.matrix mat <- mat * phi[1] return(mat) } kal.SS <- SS(kal.ts, x=list(x=c(0,diff(times))), phi=0.5, Fmat=my.Fmat, Gmat=my.Gmat, Vmat=matrix(c(3,0,0,1),nrow=2,byrow=T), Wmat=my.Wmat, m0=t(matrix(c(5,0,25,0))), #initial state - currently x,x*,y,y* (*=velocity) # initialize cov matrix for the filter C0=matrix(c(5,-0.5,0.5,0.5,-0.5,0.5,0,0,0.5,0,5,0,0.5,0,0,1),nrow=4,byrow=T) )...
2006 May 09
2
post hoc comparison in repeated measure
Hi, I have a simple dataset with repeated measures. one factor is treatment with 3 levels (treatment1, treatment2 and control), the other factor is time (15 time points). Each treatment group has 10 subjects with each followed up at each time points, the response variable is numeric, serum protein amount. So the between subject factor is treatment, and the within subject factor is time. I ran a