Displaying 20 results from an estimated 4000 matches similar to: "gls model and matrix operations"
2007 Nov 02
1
GLS with nlme
Hello All,
This is my third time attempting to post this message. I don't see it
in the archive, so I'm guessing it is not getting through. If I am
wrong, my apologies.
I am trying to do a GLS regression, (X'V^-1X)^-1X'V^-1y, using the gls()
function from the nlme package. I have the covariance matrix V. I have
been searching for a way to specify the correlation structure
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
2005 Feb 02
0
Not reproducing GLS estimates
Dear List:
I am having some trouble reproducing some GLS estimates using matrix
operations that I am not having with other R procedures. Here are some
sample data to see what I am doing along with all code:
mu<-c(100,150,200,250)
Sigma<-matrix(c(400,80,16,3.2,80,400,80,16,16,80,400,80,3.2,16,80,400),n
c=4)
sample.size<-100
temp <-
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
2008 May 09
1
Which gls models to use?
Hi,
I need to correct for ar(1) behavior of my residuals of my model. I noticed
that there are multiple gls models in R. I am wondering if anyone
has experience in choosing between gls models. For example, how
should one decide whether to use lm.gls in MASS, or gls in nlme for
correcting ar(1)? Does anyone have a preference? Any advice is appreciated!
Thanks,
--
Tom
[[alternative HTML
2007 Jan 06
1
help with gls
Hello R-users,
I am using gls function in R to fit a model with certain correlation
structure.
The medol as:
fit.a<-gls(y~1,data=test.data,correlation=corAR1(form=~1|aa),method="ML")
mu<-summary(fit.a)$coefficient
With the toy data I made to test, the estimate of mu is exactly equal to
the overall mean of y which can not be true.
But, if I make a toy data with y more than two
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)+
2001 Dec 27
1
gls
A couple of questions:
How to be sure that gls allowes errors to be correlated and/or have
unequal
variances? (is this on auto or is there a switch?)
How to calculate confidence limits for a linear regresssion?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dthompson.vcf
Type: text/x-vcard
Size: 303 bytes
Desc: Card for David Thompson
Url :
2012 Apr 19
2
Gls function in rms package
Dear R-help,
I don't understand why Gls gives me an error when trying to fit a
model with AR(2) errors, while gls (from nlme) does not. For example:
library(nlme)
library(rms)
set.seed(1)
d <- data.frame(x = rnorm(50), y = rnorm(50))
gls(y ~ x, data=d, correlation = corARMA(p=2)) #This works
Gls(y ~ x, data=d, correlation = corARMA(p=2)) # Gives error
# Error in
2006 Aug 09
1
Joint confidence intervals for GLS models?
Dear All,
I would like to be able to estimate confidence intervals for a linear
combination of coefficients for a GLS model. I am familiar with John
Foxton's helpful paper on Time Series Regression and Generalised Least
Squares (GLS) and have learnt a bit about the gls function.
I have downloaded the gmodels package so I can use the estimable
function. The estimable function is very
2008 Sep 21
1
Calculating interval for conditional/unconditional correlation matrix
Hi there,
Could anyone please help me to understand what should be done in order not to get this error message: Error: evaluation nested too deeply: infinite recursion / options(expressions=)?
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<-
2003 Sep 25
1
Error from gls call (package nlme)
Hi
I have a huge array with series of data. For each cell in the array I
fit a linear model, either using lm() or gls()
with lm() there is no problem, but with gls() I get an error:
Error in glsEstimate(glsSt, control = glsEstControl) :
computed gls fit is singular, rank 2
as soon as there are data like this:
> y1 <- c(0,0,0,0)
> x1 <- c(0,1,1.3,0)
> gls(y1~x1)
2009 Sep 22
1
odd (erroneous?) results from gls
A couple weeks ago I posted a message on this topic to r-help, the response
was that this seemed like odd behavior, and that I ought to post it to one
of the developer lists. I posted to r-sig-mixed-models, but didn't get any
response. So, with good intentions, I decided to try posting once more, but
to this more general list.
The goal is (1) FYI, to make you aware of this issue, in case it
2005 Jul 08
2
Sweave resource leak: leftover temp files (PR#7999)
This is great. Thank you for your help, but let me make sure I fully
understand. Here is the looping file I use to subset the data frame,
create a tex file, and Sweave it. This results in N number of tex files
where N is equal to the number of rows in the data frame.
list <- unique(wide$stuid)
master = "master.tex"
for (i in list){
tmp1 <- subset(wide, stuid==i)
tmp2
2003 Oct 24
2
NLME: gls parameter evaluation inconsistency (PR#4757)
Full_Name: W.B.Kloke
Version: 1.8.0
OS: FreeBSD-4.7
Submission from: (NULL) (195.253.22.63)
I found a parameter evaluation inconsistency in NLME package. I tried to use
gls() inside a function, and I wanted use gls() for different subsets of a data
frame:
prgls <- function(name){ gls( log10(Y)~(cond-1)+(cond-1):t
,pr,subset=subject==name)}
Applying this function with a string as parameter
2010 May 28
1
latex.rms and models fit with GLS
Hi,
I have fit a model using the rms package with the Gls() function.
Is there a way to get the model estimates, std errors, and p-values (i.e. what
you get with print(fit)) into latex format?
I have tried:
f <- Gls(...)
latex(f, file='')
... but I get the following error
Error in replace.substring.wild(s, old, new, test = test, front = front, :
does not handle > 1 * in
2010 Jan 07
1
faster GLS code
Dear helpers,
I wrote a code which estimates a multi-equation model with generalized
least squares (GLS). I can use GLS because I know the covariance matrix of
the residuals a priori. However, it is a bit slow and I wonder if anybody
would be able to point out a way to make it faster (it is part of a bigger
code and needs to run several times).
Any suggestion would be greatly appreciated.
Carlo
2011 Oct 18
1
Repeat a loop until...
Dear all,
I know there have been various questions posted over the years about loops but I'm afraid that I'm still stuck. 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 <-
2010 Mar 09
1
Computation of AIC for gls models
Dear Colleagues,
We are using the phylog.gls.fit() function from the R package "PHYLOGR" (Diaz-Uriarte R, Garland T: PHYLOGR: Functions for phylogenetically based statistical analyses. 2007. Available at [http://cran.r-project.org/web/packages/PHYLOGR/index.html]) to correct for lack of independence between data points. (In our particular case, the lack of independence is due to
2005 Nov 17
1
anova.gls from nlme on multiple arguments within a function fails
Dear All --
I am trying to use within a little table producing code an anova
comparison of two gls fitted objects, contained in a list of such
object, obtained using nlme function gls.
The anova procedure fails to locate the second of the objects.
The following code, borrowed from the help page of anova.gls,
exemplifies:
--------------- start example code ---------------
library(nlme)
##