Displaying 10 results from an estimated 10 matches for "getcovariate".
2009 Mar 09
1
Zero distance error in corSpatial - correlation structure using lme
Hello,
I am having a problem specifying the correlation structure in lme which
leads to the error: Error in getCovariate.corSpatial(object, data =
data) : Cannot have zero distances in "corSpatial". I have specified a
grouping variable which is the only fix I could find by searching this
error on R-help.
ISee the below example. When my samples (tran) - which are transects
sampled several times - have...
2006 Jul 01
1
nlme: correlation structure in gls and zero distance
...year.
In a first approach, I would like to use a general model of this type,
taking spatial correlation into account:
gls(IKAfox~an,correlation=corExp(2071,form=~x+y,nugget=1.22),data=renliev)
but I get
>
gls(IKAfox~an,correlation=corExp(2071,form=~x+y,nugget=1.22),data=renliev)
Error in getCovariate.corSpatial(object, data = data) :
Cannot have zero distances in "corSpatial"
I understand that the 470 geographical coordinates are repeated three
times (measurement are taken each of the three years at the same place)
which obviously cannot be handled there.
Does anybody know...
2010 Apr 14
1
creating a new corClass for lme()
...ct[["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) pmax(-1,pmin(1,a[[n]]+b[[n]])))
}
formula.corSPT <- function(object,...) {
a <- as.character(formula(object[["t...
2006 Jul 25
1
Follow Up To: Splitting the left and right hand terms of a formula
...t;))[-1])
Is there a better or cleaner way to do this?
I got one reply to try this (thanks Gabor!):
> all.vars(update(a.formula, .~0))
[1] "x"
> all.vars(update(a.formula, 0~.))
[1] "y" "z"
This works, but seems a bit of a hack.
There are two methods, "getCovariateFormula", and "getCovariate,"
which return, respectively, objects of class "formula" for the left
and right hand sides of the formula. To get the right hand side or
left hand side I wrap one of these method calls in a call to
"all.vars". Is there a better way to...
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) stop("A an...
2008 Oct 08
1
Observed responses in 'augPred' data frame - Wrong order ?
...ing the function 'augPred.lmList' I've managed to understand that
the problem resides in the following function calls:
> debug(nlme:::augPred.lmList)
> fm1.lis <- lmList(my.object)
> augPred(fm1.lis)
debugging in: augPred.lmList(fm1.lis)
debug: {
.....
primary <- getCovariate(data)
.....
groups <- getGroups(object)
.....
orig <- data.frame(primary,groups, getResponse(object))
.....
}
This approach works well on other datasets, such us the Orthodont data,
but not for mine because, i guess, my rows are not first ordered by
subject (subject is my...
2005 Nov 09
0
annot have zero distances in "corSpatial"
Hi all,
I have been attempting this repeated measure analysis
where correlation among observations (within each
subject) is spatial.
My command is:
>fdat.lme1<-lme(Lint~Rep+Treatment,data=fdat,random=~1|fldPos,correlation=corLin(form=~lat+lon))
It is generating follwoing error:
Error in getCovariate.corSpatial(object, data = data)
:
Cannot have zero distances in "corSpatial"
first I thought that decimal values of
latitude/longitude are resulting in extremely small
values of distances, causing R to ignore it. So, I
scaled it up and made the coordinates integer values.
But I am stil...
2010 Jul 28
0
nlme: augPred.lme for factor covariates
...;call must evaluate to
a data frame"))
}
if (is.null(primary)) {
if (!inherits(data, "groupedData")) {
stop(paste(sys.call()[[1]], "without \"primary\" can only be
used with fits of groupedData objects"))
}
primary <- getCovariate(data)
prName <- deparse(getCovariateFormula(data)[[2]])
}
else {
primary <- asOneSidedFormula(primary)[[2]]
prName <- deparse(primary)
primary <- eval(primary, data)
}
# allow for non numeric covariates #
if (!is.null(newprim)) {...
2004 Oct 03
1
creating new varFunc classes in nlme .. error: "Don't know how to get coefficients for .. object"
Hello. I am trying my hand at modifying the varFunc
class varExp, but I must be missing a step. All I
want to do right now is make a working copy of varExp,
call it varExp2, and then later change it.
coef.varExp2, coef<-.varExp2, and Initialize.varExp2
all seem to work properly after I construct them. I
can successfully use the commands:
v2 <- varExp2(form = ~age|Sex,fixed =
2009 Oct 21
1
odd evaluation within correlation argument of glmmPQL
...corExp(form=~x+y),
family="poisson")
## proof that glmmPQL really is looking
## outside of the data frame for its
## correlation variables ...
x = y = rep(0,100)
glmmPQL(z~1,random=~1|f,data=d,
correlation=corExp(form=~x+y),
family="poisson")
## Error in getCovariate.corSpatial(object, data = data) :
## Cannot have zero distances in "corSpatial"
> sessionInfo()
R version 2.9.2 (2009-08-24)
i486-pc-linux-gnu
locale:
LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en...