Displaying 20 results from an estimated 34 matches for "cov2".
Did you mean:
col2
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
2012 Oct 14
1
Problems with coxph and survfit in a stratified model, with interactions
...ry 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 issue: The...
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(resp~cov1...
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("A1&q...
2009 Aug 02
1
Competing Risks Regression with qualitative predictor with more than 2 categories
...t.seed(10)
> ftime <- rexp(200)
> fstatus <- sample(0:2,200,replace=TRUE)
> gg <- factor(sample(1:3,200,replace=TRUE),1:3,c('a','b','c'))
> cov <- matrix(runif(600),nrow=200)
> dimnames(cov)[[2]] <- c('x1','x2','x3')
> cov2=cbind(cov,gg)
> print(z <- crr(ftime,fstatus,cov2))
convergence: 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)
Compe...
2008 Aug 18
1
lmer syntax, matrix of (grouped) covariates?
I have a fairly large model:
> length(Y)
[1] 3051
> dim(covariates)
[1] 3051 211
All of these 211 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 +...
2024 Oct 04
3
apply
Homework questions are not answered on this list.
Best,
Uwe Ligges
On 04.10.2024 10:32, Steven Yen wrote:
> The following line calculates standard deviations of a column vector:
>
> se<-apply(dd,1,sd)
>
> How can I calculate the covariance matrix using apply? Thanks.
>
> ______________________________________________
> R-help at r-project.org mailing list -- To
2010 Jan 30
2
Questions on Mahalanobis Distance
...d 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)/ (sum(n.rows[1:...
2024 Oct 04
1
apply
...;-3 > x<-rnorm(n); x [1] 0.92098449 0.80940115
> 0.60374785 > cov1<-outer(x-mean(x),x-mean(x))/(n-1); cov1 [,1] [,2]
> [,3] [1,] 0.0102159207 0.00224105983 -0.0124569805 [2,] 0.0022410598
> 0.00049161983 -0.0027326797 [3,] -0.0124569805 -0.00273267965
> 0.0151896601 > cov2<-(x-mean(x))%*%t((x-mean(x)))/(n-1); cov2 [,1]
> [,2] [,3] [1,] 0.0102159207 0.00224105983 -0.0124569805 [2,]
> 0.0022410598 0.00049161983 -0.0027326797 [3,] -0.0124569805
> -0.00273267965 0.0151896601 >
> On 10/4/2024 4:57 PM, Uwe Ligges wrote:
>> Homework questions are...
2024 Oct 04
1
apply
...122345671) > n<-3 > x<-rnorm(n); x [1] 0.92098449 0.80940115
0.60374785 > cov1<-outer(x-mean(x),x-mean(x))/(n-1); cov1 [,1] [,2] [,3]
[1,] 0.0102159207 0.00224105983 -0.0124569805 [2,] 0.0022410598
0.00049161983 -0.0027326797 [3,] -0.0124569805 -0.00273267965
0.0151896601 > cov2<-(x-mean(x))%*%t((x-mean(x)))/(n-1); cov2 [,1] [,2]
[,3] [1,] 0.0102159207 0.00224105983 -0.0124569805 [2,] 0.0022410598
0.00049161983 -0.0027326797 [3,] -0.0124569805 -0.00273267965
0.0151896601 >
On 10/4/2024 4:57 PM, Uwe Ligges wrote:
> Homework questions are not answered on this li...
2006 Jul 11
2
Multiple tests on 2 way-ANOVA
...question: How do I proper correct for multiple testing
if I want to estimate in the presence of interaction the two average main effects.
Can some one point me to some literature where I can learn these things?
Here the example, 2x2 factorial with interaction, estimation of average main effects:
cov2 <- matrix(
c(1,-1,-1, 1,
-1, 2, 1,-2,
-1, 1, 2,-2,
1,-2,-2, 4)
, nrow=4, ncol=4, byrow=TRUE)
cm2 <- matrix(c(0, 1, 0, 1/2, 0, 0, 1, 1/2), nrow = 2, ncol=4, byrow=TRUE,
dimnames = list(c("A", "B"), c("C.1", "C.2", "C.3", "C.4"))...
2024 Oct 04
1
apply
...n<-3 > x<-rnorm(n); x [1] 0.92098449 0.80940115
>0.60374785 > cov1<-outer(x-mean(x),x-mean(x))/(n-1); cov1 [,1] [,2] [,3]
>[1,] 0.0102159207 0.00224105983 -0.0124569805 [2,] 0.0022410598
>0.00049161983 -0.0027326797 [3,] -0.0124569805 -0.00273267965
>0.0151896601 > cov2<-(x-mean(x))%*%t((x-mean(x)))/(n-1); cov2 [,1] [,2]
>[,3] [1,] 0.0102159207 0.00224105983 -0.0124569805 [2,] 0.0022410598
>0.00049161983 -0.0027326797 [3,] -0.0124569805 -0.00273267965
>0.0151896601 >
>
>On 10/4/2024 4:57 PM, Uwe Ligges wrote:
>> Homework questions are...
2009 May 22
0
EM algorithm mixture of multivariate
...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<- var(y[1:round(n/2),])...
2009 May 22
0
EM algorithm mixture of multivariate gaussian
...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<- var(y[1:round(n/2),])...
2024 Oct 04
1
apply
...t;-rnorm(n); x [1] 0.92098449 0.80940115
>> 0.60374785 > cov1<-outer(x-mean(x),x-mean(x))/(n-1); cov1 [,1] [,2]
>> [,3] [1,] 0.0102159207 0.00224105983 -0.0124569805 [2,] 0.0022410598
>> 0.00049161983 -0.0027326797 [3,] -0.0124569805 -0.00273267965
>> 0.0151896601 > cov2<-(x-mean(x))%*%t((x-mean(x)))/(n-1); cov2 [,1]
>> [,2] [,3] [1,] 0.0102159207 0.00224105983 -0.0124569805 [2,]
>> 0.0022410598 0.00049161983 -0.0027326797 [3,] -0.0124569805
>> -0.00273267965 0.0151896601 >
>> On 10/4/2024 4:57 PM, Uwe Ligges wrote:
>>> Homewo...
2024 Oct 04
2
apply
...1] 0.92098449 0.80940115
>>> 0.60374785 > cov1<-outer(x-mean(x),x-mean(x))/(n-1); cov1 [,1] [,2]
>>> [,3] [1,] 0.0102159207 0.00224105983 -0.0124569805 [2,] 0.0022410598
>>> 0.00049161983 -0.0027326797 [3,] -0.0124569805 -0.00273267965
>>> 0.0151896601 > cov2<-(x-mean(x))%*%t((x-mean(x)))/(n-1); cov2 [,1]
>>> [,2] [,3] [1,] 0.0102159207 0.00224105983 -0.0124569805 [2,]
>>> 0.0022410598 0.00049161983 -0.0027326797 [3,] -0.0124569805
>>> -0.00273267965 0.0151896601 >
>>> On 10/4/2024 4:57 PM, Uwe Ligges wrote:
>...
2024 Oct 04
3
apply
...;>>> 0.60374785 > cov1<-outer(x-mean(x),x-mean(x))/(n-1); cov1 [,1] [,2]
>>>>> [,3] [1,] 0.0102159207 0.00224105983 -0.0124569805 [2,] 0.0022410598
>>>>> 0.00049161983 -0.0027326797 [3,] -0.0124569805 -0.00273267965
>>>>> 0.0151896601 > cov2<-(x-mean(x))%*%t((x-mean(x)))/(n-1); cov2 [,1]
>>>>> [,2] [,3] [1,] 0.0102159207 0.00224105983 -0.0124569805 [2,]
>>>>> 0.0022410598 0.00049161983 -0.0027326797 [3,] -0.0124569805
>>>>> -0.00273267965 0.0151896601 >
>>>>> On 10/4/202...
2024 Oct 04
1
apply
...80940115
>>>> 0.60374785 > cov1<-outer(x-mean(x),x-mean(x))/(n-1); cov1 [,1] [,2]
>>>> [,3] [1,] 0.0102159207 0.00224105983 -0.0124569805 [2,] 0.0022410598
>>>> 0.00049161983 -0.0027326797 [3,] -0.0124569805 -0.00273267965
>>>> 0.0151896601 > cov2<-(x-mean(x))%*%t((x-mean(x)))/(n-1); cov2 [,1]
>>>> [,2] [,3] [1,] 0.0102159207 0.00224105983 -0.0124569805 [2,]
>>>> 0.0022410598 0.00049161983 -0.0027326797 [3,] -0.0124569805
>>>> -0.00273267965 0.0151896601 >
>>>> On 10/4/2024 4:57 PM, Uwe L...
2008 Aug 22
1
Help on competing risk package cmprsk with time dependent covariate
...rd errors:
[1] 0.2881 0.3644
two-sided p-values:
[1] 0.018 0.039
...That I dont understand at all since it looks like if "treatment"
covariate had also a significant effect of the first period of time !?
This is absolutely not the case.
So I m surely wrong with a part of this script... cov2 and tf are
pretty obscure for me in the help file of the package. I would really
appreciate advices regarding these 2 "terms".
I was thinking that I might changed : cbind(ifelse(uft <= 1, 1, 0), ifelse(uft > 1, 1, 0) into: cbind(ifelse(uft <= 1, 0, 1),...
2011 Apr 05
0
Changing parameter in local fdr R code
...f0e = f0
p0e = p0
if (nulltype == 0) {
f0e = f00
p0e = p0theo
}
fdre = (p0e * f0e)/(p0e * f0e + f1e)
EE[m] = sum(f1e * fdre)/sum(f1e)
}
EE = EE/EE[1]
names(EE) = mul
}
Cov2.out = loccov2(X, X0, i0, f, fp0["cmest", ], N)
Cov0.out = loccov2(X, matrix(1, length(x), 1), i0, f, fp0["thest",
], N)
if (sw == 3) {
if (nulltype == 0)
Ilfdr = Cov0.out$Ilfdr
else if (nulltype == 1)
Ilfdr = ml.out$Ilfdr...