search for: varcov

Displaying 20 results from an estimated 26 matches for "varcov".

2008 Sep 21
1
Calculating interval for conditional/unconditional correlation matrix
...sions=)? Here is my code: determinant<- function(x){det(matrix(c(1.0,0.2,0.5,0.8,0.2,1.0,0.5,0.6,0.5,0.5,0.5,1.0,x,0.8,0.6,x,1.0),ncol=4,byrow=T))} matrix<- function(x){(matrix(c(1.0,0.2,0.5,0.8,0.2,1.0,0.5,0.6,0.5,0.5,0.5,1.0,x,0.8,0.6,x,1.0),ncol=4,byrow=T))} conditional<-function(x,varcov){ varcov<-matrix(x) sigmaxx<-varcov[3,3] sigmaxz<-varcov[3,1:2] sigmayy<-varcov[4,4] sigmayz<-varcov[4,1:2] sigmazx<-varcov[1:2,3] sigmazy<-varcov[1:2,4] sigmazz<-varcov[1:2,1:2] (x-sigmaxz%*%solve(sigmaZZ)%*%sigmazy)/sqrt((sigmaxx-sigmaxz...
2011 Oct 18
1
Repeat a loop until...
...uck. I am using Windows XP and R 2.9.2. I am generating some data using the multivariate normal distribution (within the 'mnormt' package). [The numerical values of sanad and covmat are not important.] > datamat <- rmnorm(n=1500,mean=c(mean(sanad[,1]),mean(sanad[,2]),mean(sanad[,3])),varcov=covmat) The middle column of 'datamat' is simulated data for age. Obviously some of the simulated values are not going to be sensible. Therefore I'd like to set up a function that looks at each row of 'datamat' and if the value for the middle column is <5 or >86 then th...
2009 Sep 14
2
Function "Varcov" in Design (Ver. 2.2-0) package
Hi, I'm running into an error message for the "anova"-function I never got before with the Design (Version 2.2-0) package. There seems to be a missing function "Varcov", please check my function calls (it's in german but I think you get the error): > library(Design) ## attaching Design package and dependent packages Lade n?tiges Paket: Hmisc ## loading dependent packages Lade n?tiges Paket: survival Lade n?tiges Paket: splines Attache Paket: &...
2009 Aug 20
1
Understanding R code
What is 1. par.ests <- optimfit$par 2. fisher <- hessb(negloglik, par.ests, maxvalue=maxima); 3. varcov <- solve(fisher); 4. par.ses <- sqrt(diag(varcov)); Thanks a lot, fit.GEV <- function(maxima) { sigma0 <- sqrt((6. * var(maxima))/pi) mu0 <- mean(maxima) - 0.57722 * sigma0 xi0 <- 0.1 theta <- c(xi0, mu0, sigma0) #10/5/2007: removed assign() for maxima.nl #10/5/2007: passed...
2009 Sep 12
2
could not find function "Varcov" after upgrade of R?
After upgrading R to 2.9.2, I can't use the anova() fuction. It says "could not find function "Varcov" ". What's wrong with my computer? Help needed, thanks! Yao Zhu Department of Urology Fudan University Shanghai Cancer Center No. 270 Dongan Road, Shanghai, China [[alternative HTML version deleted]]
2003 Jul 27
1
multiple imputation with fit.mult.impute in Hmisc
...X2 ... [for the model of interest], xtrans=f, fitter=lm, data=t1) and all goes well (usually) except that we get the following message at the end of the last step: Warning message: Not using a Design fitting function; summary(fit) will use standard errors, t, P from last imputation only. Use Varcov(fit) to get the correct covariance matrix, sqrt(diag(Varcov(fit))) to get s.e. I did try using sqrt(diag(Varcov(fmp))), as it suggested, and it didn't seem to change anything from when I did summary(fmp). But this Warning message sounds scary. It sounds like the whole process of multiple im...
2011 Mar 04
2
overleap an iteration within a for-loop when error message produced
...s doubtful)" obviously because "NaNs" were produced. Is it possible to tell R that it should overleap the iteration which produce the error message? Here is an example code (does not lead to an error message): for (subject in 1:10) { p[subject] = pmnorm(x = subject*c(-.3,1), varcov = diag(2)) } Assume that the 5th iteration (subject=5) leads to the error message. How can I tell R to continue with the 6th iteration? Thanks a lot for you help and input, Nicolas ____________ lic. phil. Nicolas A. J. Berkowitsch Universit?t Basel Fakult?t f?r Psychologie Economic Psycholog...
2005 Feb 02
0
Not reproducing GLS estimates
...Now, I am trying to replicate the gls using matrix techniques. Here is my code for to solve (X' V^{-1} X) ^{-1} X' V^{-1} y for the point estimates and (X' V^{-1} X) ^{-1} for the standard errors. score<-long$score X.mat<-model.matrix(score~time, long, row.names=F) var.mat<-getVarCov(fm1) I<-diag(sample.size) V <- kronecker(I,var.mat) pe<-solve(crossprod(X.mat,solve(V,X.mat)))%*%crossprod(X.mat,solve(V,sco re)) varcov<-solve(crossprod(X.mat,solve(V,X.mat))) This perfectly replicates the gls point estimates, but does not replicate the standard errors. The reason I a...
2004 Dec 29
3
gls model and matrix operations
...time<-long$time-1 With these data I then use the gls function to estimate the following model Y_{ti} = mu + beta(time) + e_{ti} fm1 <- gls(score ~ time, long, correlation=corAR1(form=~1|stuid), method='ML') >From here I can obtain V, the variance covariance matrix using the getVarCov function as follows: var.mat<-getVarCov(fm1) I<-diag(1,sample.size) # The following 2 steps are needed to make V conformable for multiplication later V<-kronecker(I,var.mat) I then need to modify the V matrix and then reestimate the gls() by brute force using matrix operations. None of...
2000 Mar 22
4
density ellipses?
Hello, has anybody written a function to plot density ellipses (95%, 99% or anything) in a scatterplot? I found nothing in any package, nor in the list archives. There does seem to be a contributed package "ellipse" for S-Plus (on S-Archive), but it does a lot more than what I would need. Still, if anybody ported it to R, I'd be grateful for a link. I'm a bit afraid to try the
2009 Sep 17
1
Error message in Design library
...ponse ~ p_value, data=c_abl_oncogene_1_RTK) When I run the following command . . . . prediction.1 <- predict(model.1, type=c("fitted")) I get the following error message. . . . Error in predictDesign(object, ..., type = "lp", se.fit = FALSE) : could not find function "Varcov" It seems like a required function of "predict" may be missing in the Design package (although I doubt Professor Harrell would have overlooked this). Perhaps its my own stupidity with something. Any ideas what could be causing this? I'm sorry I didn't post a reproducable ex...
2009 Sep 26
1
Summary/Bootstrap for Design library's lrm function
..., na.action = na.delete, var.penalty = "simple") ## It will give me coefficients and residuals, but nothing else really. When I try to enter "summary" it gives me this error message## > summary(bigassmall) Error in summary.Design(bigassmall) : could not find function "Varcov" ##So I thought I'd try to find a back door in, manually bootstrapping to verify then getting values that way and I get this error message## > validate(bigassmall, method=boot, B=50) Error in validate.lrm(bigassmall, method = boot, B = 50) : fit did not use x=T,y=T ################...
2011 Feb 09
2
Generate multivariate normal data with a random correlation matrix
...iform sample of n.tri possible correlations (runi(n.tr,-.99,.99) Populate a triangle of the matrix with the sampled correlations Mirror the triangle to populate the other triangle forming a symmetric matrix, cormat Sample n observations from a multivariate normal distribution with mean vector=0 and varcov=cormat Problem: This approach violates the triangle inequality property of correlation matrices. ?So, the matrix I've constructed is certainly a valid matrix but it is not a valid correlation matrix and it blows up when you submit it to a random number generator such as rmnorm. ?With a small...
2003 Apr 17
0
kriging in R
Hi If you read the description of "varcov.spatial" you'll see that it is used to *predict* a covariance matrix, based on the parameters of the covariance function. So you don't need the oebserved data, you need parameters for the covariance function. Regards EJ On Thu, 2003-04-17 at 05:43, Yan Yu wrote: > THanks for the...
2010 Aug 04
1
geoR - likfit failure
Hi I'm using geoR package to perform linear spatial interpolation(OK). The function likfit() fails to compute REML. The error meassage is : Error in solve.default(v$varcov, xmat); How I can find out that likfit() is failed to process and retrieving the error message ? Thank you so much for your help.
2006 Oct 03
1
nlme_varcov matrix
Hi all! Is there a function that provides the VarCov matrix for a nlme objects? How I can extract the matrix for a nlme model fitted? I would appreciate any guidance Regards Lic. Gabriela Escati Pe?aloza Biolog?a y Manejo de Recursos Acu?ticos Centro Nacional Patag?nico(CENPAT). CONICET Bvd. Brown s/n?. (U9120ACV)Pto. Madryn Chubut Argentina Te...
2011 May 05
1
matrix not positive definite (while it should be)
...(CORRELATION)$values) [1] 0.09504902 theoretically, it should be 0 for SIGMA, but here it is not the case. The problem here is that here, I cannot generate a Gaussian random vector with that specific covariance matrix, since Cholesky does not work... > library(mnormt) > RES=rmnorm(n,mean=MU,varcov=SIGMA) Error in chol.default(varcov) : the leading minor of order 4 is not positive definite any suggestions ? perhaps a better way of building my covariance matrix ? or another way of generating a random vector with that specific covariance matrix ? Thanks for your help.... [[alternative HTM...
2002 Mar 30
2
Inconsistency among mean, median, max, var
I found a strange inconsistency: If m is a matrix and d is a data frame then - mean(m), median(m), max(m) and max(d) all return a single value but - mean(d) returns the column means - median(d) fails - both var(m) and var(d) return the variance covariance matrix You pretty much have to experiment to figure this out since much of this behavior is not readily obvious from the help files.
2008 Sep 22
1
R-help Digest, Vol 67, Issue 23
...sions=)? Here is my code: determinant<- function(x){det(matrix(c(1.0,0.2,0.5,0.8,0.2,1.0,0.5,0.6,0.5,0.5,0.5,1.0,x,0.8,0.6,x,1.0),ncol=4,byrow=T))} matrix<- function(x){(matrix(c(1.0,0.2,0.5,0.8,0.2,1.0,0.5,0.6,0.5,0.5,0.5,1.0,x,0.8,0.6,x,1.0),ncol=4,byrow=T))} conditional<-function(x,varcov){ varcov<-matrix(x) sigmaxx<-varcov[3,3] sigmaxz<-varcov[3,1:2] sigmayy<-varcov[4,4] sigmayz<-varcov[4,1:2] sigmazx<-varcov[1:2,3] sigmazy<-varcov[1:2,4] sigmazz<-varcov[1:2,1:2] (x-sigmaxz%*%solve(sigmaZZ)%*%sigmazy)/sqrt((sigmaxx-sigmaxz...
2003 Oct 06
1
vif() from Design and car
Hi, I've been generating linear models with lm(). I wanted to look at the VIF's for the coefficient. Using the vif() function from the package Design, I would get unusually high VIF's. However using vif() from the car package I get more reasonable values (ie in line with the quality of the model). What is the difference between the two vif functions? (I dont have access to the