Displaying 20 results from an estimated 29 matches for "cov1".
Did you mean:
com1
2012 Oct 13
4
Problems with coxph and survfit in a stratified model with interactions
I?m trying to set up proportional hazard model that is stratified with
respect to covariate 1 and has an interaction between covariate 1 and
another variable, covariate 2. Both variables are categorical. In the
following, I try to illustrate the two problems that I?ve encountered, using
the lung dataset.
The first problem is the warning:
To me, it seems that there are too many dummies
2003 Apr 28
2
stepAIC/lme problem (1.7.0 only)
I can use stepAIC on an lme object in 1.6.2, but
I get the following error if I try to do the same
in 1.7.0:
Error in lme(fixed = resp ~ cov1 + cov2, data = a, random = structure(list( :
unused argument(s) (formula ...)
Does anybody know why?
Here's an example:
library(nlme)
library(MASS)
a <- data.frame( resp=rnorm(250), cov1=rnorm(250),
cov2=rnorm(250), group=rep(letters[1:10],25) )
mod1 <- lme(re...
2012 Oct 14
1
Problems with coxph and survfit in a stratified model, with interactions
...Please try to fix this in the future (Nabble issue?)
As to the problems: handling strata by covariate interactions turns out to be a bit of a
pain in the posteriorin the survival code. It would have worked, however, if you had done
the following:
fit <- coxph(Surv(time, status) ~ strata(cov1) * cov2, data=...)
or ~ strata(cov1):cov2
or ~ strata(cov1):cov2 + cov2
But by using
~ strata(cov1) + cov1:cov2
you fooled the program into thinking that there was no strata by covariate interaction,
and so it did not follow the special logic necessary for that case.
Second is...
2013 Oct 18
1
crr question in library(cmprsk)
Hi all
I do not understand why I am getting the following error message. Can
anybody help me with this? Thanks in advance.
install.packages("cmprsk")
library(cmprsk)
result1 <-crr(ftime, fstatus, cov1, failcode=1, cencode=0 )
one.pout1 = predict(result1,cov1,X=cbind(1,one.z1,one.z2))
predict.crr(result1,cov1,X=cbind(1,one.z1,one.z2))
Error: could not find function "predict.crr"
[[alternative HTML version deleted]]
2003 Jun 04
3
Slow ttests in R-devel
...drastically
slower under current R-devel vs. current R-patched - one example is below
using a ttest. I have the following snippet of code that demonstrates the
problem while avoiding "real" code that takes an extremely long time to
finish on R-devel:
library(genefilter)
data(eset)
eset$cov1
z <- ttest(eset$cov1, p=0.01)
gf <- filterfun(z)
system.time(genefilter(eset, gf))
(this requires the genefilter & Biobase packages from Bioconductor)
Using R-1.7.0p I had the following output:
> data(eset)
> eset$cov1
[1] 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2
>...
2005 Oct 05
1
Analyses of covariation with lme() or lm()
...better than m2. So far so good.
Now I have one (1) measure from each Trial, of soil factors weather and
such, that I want to evaluate. Remember: only one value of the covariate
for each Trial. The suggestion I have got from my local guru is to base
this in m1 like:
m3 <- lme(Yield ~ Treat + Cov1 + Treat:Cov1, data=data,
random =~1| Trial/Block)
thus giving a model where the major random factor (Trial) is represented
both as a (1) measure of Cov1 in the fixed part and by itself in the
random part. Trying the simpler call:
m4 <- lm(Yield ~ Treat + Cov1 + Treat:Cov1, data=...
2012 Jul 06
2
Anova Type II and Contrasts
the study design of the data I have to analyse is simple. There is 1 control group (CTRL) and 2 different treatment groups (TREAT_1 and TREAT_2).
The data also includes 2 covariates COV1 and COV2. I have been asked to check if there is a linear or quadratic treatment effect in the data.
I created a dummy data set to explain my situation:
df1 <- data.frame(
Observation = c(rep("CTRL",15), rep("TREAT_1",13), rep("TREAT_2", 12)),
COV1 = c(rep(&...
2012 Apr 08
1
Avoid loop with the integrate function
...n 1:length(ed$ID))
{
ed$base[k]<-100*exp(rnorm(1,0,0.05))
ed$drop[k]<-0.2*exp(rnorm(1,0,0.01))
ed$frac[k]<-0.5*exp(rnorm(1,0,0.1))
}
comb1<-merge(data1[, c("ID","TIME")], ed)
comb2<-comb1
comb2$score<-comb2$base*exp(-comb2$drop*comb2$TIME)
func1<-function(t,cov1,beta1, change,other)
{
ifelse(t==0,cov1, cov1*exp(beta1*change+other))
}
comb3<-comb2
comb3$cmhz=0
comb3<-comb3[order(comb3$ID, comb3$TIME), ]
for (q in 1:length(comb3$ID))
{
comb3$cmhz[q]<-integrate(func1, lower=0, upper=comb3$TIME[q],
cov1=0.001,beta1=0.02,
change=comb...
2008 Aug 18
1
lmer syntax, matrix of (grouped) covariates?
...covariates need to be nested hierarchically within a
grouping "class", of which there are 8. I have an accessory vector, "
cov2class" that specifies the mapping between covariates and the 8 classes.
Now, I understand I can break all this information up into individual
vectors (cov1, cov2, ..., cov211, class1, class2, ..., class8), and do
something like this:
model <- lmer(Y ~ 1 + cov1 + cov2 + ... + cov211 +
(cov1 + cov2 + ... | class1) +
(...) +
(... + cov210 + cov211 | class8)
But I'd like keep things syntactica...
2005 Feb 23
1
How to conctruct an inner grouping for nlme random statement?
Hello. Im hoping someone can help with a grouping
question related to the "random=" statement within the
nlme function. How do you specify that some grouping
levels are inner to others? I tried several things,
given below.
Lets say I have a data frame with five variables,
resp, cov1, ran1, ran2, group1, and group 2. The
formula is resp~cov1 + ran1 + ran2, where the ran are
random variables. The data is of length 80, and there
are 4 unique factors in group1 and 20 unique factors
in group2. These are factors related to ran1 and
ran2, respectively.
The difficult part is tha...
2010 Jan 30
2
Questions on Mahalanobis Distance
...matrix (the third argument supplied to the mahalanobis
funtion).
Any help or guidance would be greatly appreciated.
Thank you! RL
CODE
fit<-lda(pop~v1 + v2 + v3 +...+vn, data=my.data)
x1<-subset(my.data, pop==1)
x2<-subset(my.data, pop==2)
#Save Covariance Matices for each group
cov1<-cov(x1)
cov2<-cov(x2)
#Determine number of rows in each matrix
n1<-nrow(x1); n2<-nrow(x2);
n.rows<-c(n1,n2)
#store mean vectors from lda object
mu1<-fit$means[1,]
mu2<-fit$means[2,]
#Calculate the common Covariance Matrix
S<-(((n.rows[1]-1)*cov1)+((n.rows[2]-1)*cov2...
2006 Jul 11
2
Multiple tests on 2 way-ANOVA
Dear r-helpers,
I have a question about multiple testing.
Here an example that puzzles me:
All matrixes and contrast vectors are presented in treatment contrasts.
1. example:
library(multcomp)
n<-60; sigma<-20
# n = sample size per group
# sigma standard deviation of the residuals
cov1 <- matrix(c(3/4,-1/2,-1/2,-1/2,1,0,-1/2,0,1), nrow = 3, ncol=3, byrow=TRUE,
dimnames = list(c("A", "B", "C"), c("C.1", "C.2", "C.3")))
# cov1 = variance covariance matrix of the beta coefficients of a
# 2x2 factorial design (see Pian...
2006 Mar 11
2
Draw level lines on the surface of a bivariate function
...of them are, of
course, visible
even if they are drawn on a non visible "face".
Any suggestion to avoid this problem ?
Thank you
Etienne
Example :
trans3d <- function(x,y,z, pmat)
{
tr <- cbind(x,y,z,1) %*% pmat
list(x = tr[,1]/tr[,4], y= tr[,2]/tr[,4])
}
mean1 = c(2,4)
cov1 = matrix(c(0.7, 0.2,0.2,0.7), ncol=2)
x = seq(0, 5, by = 0.1)
y = seq(0,10, by= 0.1)
z = matrix(nrow = length(x), ncol=length(y))
for(i in 1:length(x))
for(j in 1:length(y))
{
z[i,j]=dmvnorm(c(x[i],y[j]),mean1,cov1)
}
pmat1 = persp(x, y, z, col= "red",shade = 0.25, border=NA)...
2009 May 22
0
EM algorithm mixture of multivariate
...s="blue",
col.grid="lightblue",angle=120, pch=20)
em2mn<- function(y)
{
n<-length(y[,1])
p<-matrix(0,n,1)
f1<-matrix(0,n,1)
f2<-matrix(0,n,1)
tau<-matrix(0,n,2)
eps<-0.0001
mu01<-c(0,0)
mu02<-c(0,0)
sd01<-matrix(0,2,2)
sd02<-matrix(0,2,2)
cov1<-matrix(0,2,2)
cov2<-matrix(0,2,2)
# 1 inizializzare i valori
alpha0= runif(1,0,1)
for (j in 1:2) {
mu01[j] <- runif(1,min=quantile(y[,j], probs =0.25),
max=quantile(y[,j], probs =0.75))
mu02[j] <- runif(1,min=quantile(y[,j], probs =0.25),
max=quantile(y[,j], probs =0.75))
}
sd01<-...
2009 May 22
0
EM algorithm mixture of multivariate gaussian
...s="blue",
col.grid="lightblue",angle=120, pch=20)
em2mn<- function(y)
{
n<-length(y[,1])
p<-matrix(0,n,1)
f1<-matrix(0,n,1)
f2<-matrix(0,n,1)
tau<-matrix(0,n,2)
eps<-0.0001
mu01<-c(0,0)
mu02<-c(0,0)
sd01<-matrix(0,2,2)
sd02<-matrix(0,2,2)
cov1<-matrix(0,2,2)
cov2<-matrix(0,2,2)
# 1 inizializzare i valori
alpha0= runif(1,0,1)
for (j in 1:2) {
mu01[j] <- runif(1,min=quantile(y[,j], probs =0.25),
max=quantile(y[,j], probs =0.75))
mu02[j] <- runif(1,min=quantile(y[,j], probs =0.25),
max=quantile(y[,j], probs =0.75))
}
sd01<-...
2002 Dec 04
1
Mixture of Multivariate Gaussian Sample Data
Hey, I am confused about how to generate the sample data from a mixture of
Multivariate Gaussian ditribution.
For example, there are 2 component Gaussian with prior
probability of 0.4 and 0.6,
the means and variances are
u1=[1 1]', Cov1=[1 0;0 1]
and
u2=[-1 -1]', Cov2=[1 0;0 1]
repectively.
So how can I generate a sample of 500 data from the above mixture
distribution?
Thanks.
Fred
2010 Jan 29
2
Vectors with equal sd but different slope
Hi,
what I would need are 2 vector pairs (x,y) and (x1,y1). x and x1 must have
the same sd. y and y1 should also exhibit the same sd's but different ones
as x and x1. Plotting x,y and x1,y1 should produce a plot with 2 vectors
having a different slope. Plotting both vector pairs in one plot with fixed
axes should reveal the different slope.
many thanks
syrvn
--
View this message in
2004 Oct 31
3
strange results with dmvnorm
...64824,10465,58176,36662,19769,9080,45041,16080,49648,59638
,23339,40697,47107,8536,57035,55090,44414,1321,12861,21108,32654,27068,38365,22255,31550,11789,45404,53969
,13509,36350)
Dist <- sqrt(outer(x,x, "-")^2 + outer(y,y, "-")^2)
Dist <- Dist/max(Dist)
library(spatial)
Cov1 <- sphercov(Dist, 0.8, alpha=0, se=sqrt(2))
Cov2 <- sphercov(Dist, 0.6, alpha=0, se=sqrt(0.55))
library(geoR)
Cov1b <- cov.spatial(Dist, cov.model= "spherical", cov.pars=c(2, 0.8))
Cov2b <- cov.spatial(Dist, cov.model= "spherical", cov.pars=c(0.55, 0.6))
library(mvt...
2009 Aug 02
1
Competing Risks Regression with qualitative predictor with more than 2 categories
...ence: TRUE
coefficients:
x1 x2 x3 gg
0.2624 0.6515 -0.8745 -0.1144
standard errors:
[1] 0.3839 0.3964 0.4559 0.1452
two-sided p-values:
x1 x2 x3 gg
0.490 0.100 0.055 0.430
> summary(z)
Competing Risks Regression
Call:
crr(ftime = ftime, fstatus = fstatus, cov1 = cov2)
coef exp(coef) se(coef) z p-value
x1 0.262 1.300 0.384 0.683 0.490
x2 0.652 1.918 0.396 1.643 0.100
x3 -0.874 0.417 0.456 -1.918 0.055
gg -0.114 0.892 0.145 -0.788 0.430
[[alternative HTML version deleted]]
2015 May 16
1
That 'make check-all' problem with the survival package
...after 3 months.
-----------------------------------------------
ERROR
Errors in running code in vignettes:
when running code in ?compete.Rnw?
...
> temp$fstat <- as.numeric(event)
> temp$msex <- with(temp, 1 * (sex == "M"))
> fgfit1 <- with(temp, crr(etime, fstat, cov1 = cbind(age,
+ msex, mspike), failcode = 2, cencode = 1, variance = TRUE))
When sourcing ?compete.R?:
Error: could not find function "crr"
Execution halted
* checking re-building of vignette outputs ... NOTE
Error in re-building vignettes:
...
Warning in coxph(Surv(futime, deat...