search for: getvarcov

Displaying 17 results from an estimated 17 matches for "getvarcov".

2007 Jun 25
3
Bug in getVarCov.gls method (PR#9752)
Hello, I am using R2.5 under Windows. Looks like the following statement vars <- (obj$sigma^2)*vw in getVarCov.gls method (nlme package) needs to be replaced with: vars <- (obj$sigma*vw)^2 With best regards Andrzej Galecki Douglas Bates wrote: >I'm not sure when the getVarCov.gls method was written or by whom. To >tell the truth I'm not really sure what it should do. > &gt...
2007 Jan 06
1
help with gls
...y<-rep(0,N*20) for (ii in 1:20) {y[((ii-1)*N+1):(ii*N)]<-rmvnorm(1, mean=rep(0,N), sigma=Sigma.a) } test.data<-data.frame(y=y,aa=rep(1:20,each=N,len=N*20)) fit.a<-gls(y~1,data=test.data,correlation=corAR1(form=~1|aa),method="ML") mu.a<-summary(fit.a)$coefficient rho.a<-getVarCov(fit.a)[1,2]/getVarCov(fit.a)[1,1] print(c(mean(y),mu.a)) ______________________________________________________ Zhenqiang (James) Lu Department of Statistics Purdue University West Lafayette, IN 47906 TEL: (765) 494-0027 FAX: (765) 494-0558
2009 Mar 23
1
Extracting SD of random effects from lme object
Hello, How do I get the standard deviations for the random effects out of the lme object? I feel like there's probably a simple way of doing this, but I can't see it. Using the first example from the documentation: > fm1 <- lme(distance ~ age, data = Orthodont) # random is ~ age > fm1 Linear mixed-effects model fit by REML Data: Orthodont Log-restricted-likelihood:
2007 Dec 05
0
lme output
...latter can be derived as a Cholesky factorization of the product between the residuals variance and the inverse of the random effects covariance. When I check that it's not the case for model fm1 even if it's equivalent to model fm2. log(chol(((summary(fm1)$sigma)^2)*solve( matrix(getVarCov(fm1), nrow=2)))) [,1] [,2] [1,] -0.3424971 1.492037 [2,] -Inf 1.755388 log(chol(((summary(fm2)$sigma)^2)*solve( matrix(getVarCov(fm2), nrow=2)))) [,1] [,2] [1,] -0.3424971 1.492037 [2,] -Inf...
2007 Sep 18
0
Extracting variance-covariance matrix from nlme object
I want to extract the variance-covariance matrix of an nlme model of a dataset. The object is to pass this to mvrnorm to create pseudo- replicates of the original data. I note the nlme package has a getVarCov method available for lme objects but not nlme objects. Is the vcov function in the base stats package suitable? If so, why is the additional getVarCov provided? thank you Rob Forsyth
2007 Jun 20
2
Linear Mixed Models with nlme, more than one random effect
...ay as random effect, I use res.lme <- lme(resp ~ oper + block , random=~1|day) If I want to include also another random effect, as "experiment", what I should do ? This effect doesn't have to be nested, at the and I would like to have the COV matrix using (if I'm not wrong) getVarCov function. Thanks in advance for any help or suggestions, I'm a beginner on this field... Davide _________________________________________________________________ Cinema, Tv, Gossip e Orsoscopo Tutto su MSN intrattenimento!
2004 Dec 29
3
gls model and matrix operations
...ng$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...
2008 Aug 29
3
extract variance components
HI, I would like to extract the variance components estimation in lme function like a.fit<-lme(distance~age, data=aaa, random=~day/subject) There should be three variances \sigma_day, \sigma_{day %in% subject } and \sigma_e. I can extract the \sigma_e using something like a.fit$var. However, I cannot manage to extract the first two variance components. I can only see the results in
2006 Jun 30
1
lme and SAS Proc mixed
...int estimates are essentially the same comparing R and SAS for the fixed effects, but the 95% confidence intervals are much shorter using lme(). In order to find the difference in the algorithms used by SAS and R I tried to extract the variance-covariance matrix to look at its structure. I used the getVarCov() command, but it tells me that this function is not available for nested structures. Is there another way to extract the variance-covariance structure for nested models? Does anyone know how I could get the var-cov structure above using lme? Kellie J. Archer, Ph.D. Assistant Professor, Departmen...
2006 Mar 07
1
lme and gls : accessing values from correlation structure and variance functions
Dear R-users I am relatively new to R, i hope my many novice questions are welcome. I have problems accessing some objects (specifically the random effects, correlation structure and variance function) from an object of class gls and lme. I used the following models: yah <- gls (outcome~ -1 + as.factor(Trial):as.factor(endpoint)+
2006 Jun 30
0
SAS Proc Mixed and lme
...int estimates are essentially the same comparing R and SAS for the fixed effects, but the 95% confidence intervals are much shorter using lme(). In order to find the difference in the algorithms used by SAS and R I tried to extract the variance-covariance matrix to look at its structure. I used the getVarCov() command, but it tells me that this function is not available for nested structures. Is there another way to extract the variance-covariance structure for nested models? Does anyone know how I could get the var-cov structure above using lme? Kellie J. Archer, Ph.D. Assistant Professor, Departmen...
2010 Jan 15
1
'nlme' library - lme function results
Dear R-helpers I am running a simple mixed effects model using lme(). The call looks like this: fit <- lme(Analyte~Sample, data=Data, random=~1 | Run) I am particularly interested in the estimated random effects. When I print the 'fit' object, it looks something like example below: (...) Random effects: Formula: ~1 | Run (Intercept) Residual StdDev: 3.483794 3.637523
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...
2002 May 29
1
Extracting intercept and residual std dev from lme results
Greetings- I need to extract, programatically, the standard deviations of the intercept and residuals from an lme model. These are presented by print.lme as: ... (Intercept) Residual StdDev: 1.410635 0.7800512 ... (data taken from ?lme's examples section) I can get the residuals with x$sigma where x is the fitted lme object. I can't find the intercept, though. The closest
2005 Jan 20
3
Constructing Matrices
Dear List: I am working to construct a matrix of a particular form. For the most part, developing the matrix is simple and is built as follows: vl.mat<-matrix(c(0,0,0,0,0,64,0,0,0,0,64,0,0,0,0,64),nc=4) Now to expand this matrix to be block-diagonal, I do the following: sample.size <- 100 # number of individual students I<- diag(sample.size) bd.mat<-kronecker(I,vl.mat) This
2003 Mar 04
2
How to extract R{i} from lme object?
Hi, lme() users, Can some one tell me how to do this. I model Orthodont with the same G for random variables, but different R{i}'s for boys and girls, so that I can get sigma1_square_hat for boys and sigma2_square_hat for girls. The model is Y{i}=X{i}beta + Z{i}b + e{i} b ~ iid N(0,G) and e{i} ~ iid N(0,R{i}) i=1,2 orth.lme <- lme(distance ~ Sex * age, data=Orthodont, random=~age|Subject,
2004 Aug 03
2
lme fitted correlation of random effects: where is it?
The print method for lme *prints out* the fitted correlation matrix for the random effects. Is there any way to get these values as an object in R? I have examined the components of the lme object (called "junk" in the example below) and the components of summary(junk) without finding these numbers. (How I did this: I dumped the entire lme object to a text file and then used egrep to