Displaying 20 results from an estimated 4000 matches similar to: ""competitive risk model""
2011 Aug 16
2
how to get the result in "short cut" manner?
Hi all:
My data:data(sleep)
If I wanna calculate each group's extra,what I can do is:
#method1
attach(sleep)
mean(extra[group==1])
mean(extra[group==1])
#method2
result<-matrix(,0,2)
g<-split(sleep,sleep$group)
for(i in 1:length(g))
{
result<-rbind(result,data.frame(unique(g[[i]]$group),mean(g[[i]]$extra)))
}
colnames(result)<-c("name","mean")
But the above
2011 Aug 16
4
a question about lm on t-test.
Hi all:
I have a question about lm on t-test.
data(sleep)
I wanna perform t-test to test the difference between the 2 groups:
I can use:
t.test(extra~group)
The t.test result shows that:t = -1.8608; mean1=0.75,mean2=2.33
But I still wanna use:
summary(lm(extra~group))
Intercept=0.75,which is mean1,just the same as t.test.
group2=1.58 means the difference of the 2 groups,so
2009 Aug 12
2
Superscripts in axis label
Hi All,
I am trying to lable the y-axis on my scatterplot with the following:
"Soil moisture content (m3m-3)"
I am using the following coding for plotting the graph:
plot(soilmoisture~gradientlevel, xlab="Levels of droughting gradient", ylab="Soil moisture content (m3m-3)", bty="l", font.main="2", pch=16, las=1, cex.lab="1.13")
I have
2011 Oct 10
3
How to test if two C statistics are significantly different?
Hey all,
In order to test if a marker is a risk factor, I built two models (using cox
proportional hazard model). One model included this marker, and the other is
not.
Then, I use R package risksetROC to test how much predictive value did the
marker add to this model. I get two C statistics by analyzing the linear
predictors of the two models into this package.
The qustion is How to test if two
2011 Oct 22
7
"Plotting" text?
I noticed that the text() command adds text to a plot. Is there a way to
either make the plot blank or add text to a "blank sheet". I would like
to "plot" a page that contains just text, no plot lines, labels, etc.
Suggestions?
Kevin
[[alternative HTML version deleted]]
2011 Apr 27
2
ROCR for combination of markers
Dear list
I have 5 markers that can be used to detect an infection in combination. Could you please advise me how to use functions in ROCR/ other package to produce the ROC curve for a combination of markers?
I have used the following to get ROC statistics for each marker.
pred <- prediction(y$marker1, y$infectn)
perf <-performance(pred,"tpr","fpr")
2011 Feb 09
3
Loop in variable names
Hello!
I would like to do some tables for several variables and I would like to write a loop that does the table for each variable. I should also point out that my data set has several missing observations and sometimes the observations that are missing are not the same for all my variables.
What I would like to do:
table(StoreData$CompanyID,
!is.na(StoreData$P2))
2011 Jul 28
3
construct a data set
Hi,
i want to construct a data set similar to "AirPassengers".
Its attributes are following.
> attributes(AirPassengers)
$tsp
[1] 1949.000 1960.917 12.000
$class
[1] "ts"
How Can I construct a data set similar to it having same class and attributes.
Thanks
--
Amar Kumar Nandan
?:nandan.amar at gmail.com
http://aknandan.co.nr
2012 Feb 21
2
Using substitute in nested function calls
Dear List members,
I really, like the feature that one can call R functions with
mathematical expressions, e.g.
curve(x^2, 0, 1)
I wonder, how I can construct in a simple way a function like
mycurve = function (expr) {...}
such that that a call
mycurve(x^2)
has the same effect as the call
curve(x^2, -100,100)
Below is some code that works, but it seems much to complicated: it
first
2011 Apr 28
2
changing a specific column name
Hi,
Can someone please tell me how to change the column name of a specific
column. How do I change the name of the column 'Species'?
Thanks in advance
d <- iris
colnames(d)
[1] "Sepal.Length" "Sepal.Width" "Petal.Length" "Petal.Width" "Species"
ind <- which(names(d)=='Species')
ind
[1] 5
colnames(d[ind])
[1]
2011 Jul 29
2
Changing font type within y axis labels
I wish place the following axis label in such a manner that some of the
text is plain and the scientific name is in italics (i.e. a mixture of
two font types)
Using plot:
mtext("Total Landings of Pecten maximus (tonnes)",font,=3, side=2,
line=3)
makes everything italic, but how do I apply the font change to only
"Pecten maximus"?
Rgds
Phil
2011 Aug 17
3
Obtaining variable's names from a list of variables
Say I have a list of variables,
listVar <- list(age,sex)
I am looking for a way to either
1- create a vector c("age","sex") from it, or
2- get the names one by one in a for loop such as these
a) for (i in 1:length(listVar)) rownames(result)[i] <- ???
b) for(i in listVar) print (variable's name)
Any help much appreciated.
[[alternative HTML version
2011 Feb 18
3
How to change dataframe to tables
The data is in the attachment.
What I wanna get is:
, , Sex = Male
Eye
Hair Brown Blue Hazel Green
Black 32 11 10 3
Brown 53 50 25 15
Red 10 10 7 7
Blond 3 30 5 8
, , Sex = Female
Eye
Hair Brown Blue Hazel Green
Black 36 9 5 2
Brown 66 34 29 14
Red 16 7 7 7
Blond 4
2011 Mar 14
7
creating character vector
Is there a way to convince R to create a character vector without using the quotes?
This works
ex1 <- c("first","second")
but when I try this it doesn't
ext <- as.character(c(first,second))
it complains. I have many variables to put into character vectors so dispensing with the quotes would be useful.
Thanks
Jim
===============================
Dr. Jim Maas
2011 Sep 19
3
Replace a for loop with a function
Hi all,
I would like to replace the for loop in the code below with a function
to improve the speed and to make the script more efficient.
The loop creates a vector of integers (x) with the probability of f for
each integer.
The length of f is variable, but sums to 1.
I tried to use a function with optional arguments which did not work.
Here is the code:
f <- data.matrix(c(0.5,0.15,0.35))
2011 Jan 19
3
question about result of loglinear analysis
Hi all:
Here's a question about result of loglinear analysis.
There're 2 factors:area and nation.The raw data is in the attachment.
I fit the saturated model of loglinear with the command:
glm_sat<-glm(fre~area*nation, family=poisson, data=data_Analysis)
After that,I extract the coefficients:
result_sat<-summary(glm_sat)
result_coe<-result_sat$coefficients
I find that all the
2011 Feb 11
3
How can we make a vector call a function element-wise efficiently?
Hello
I have a time-comsuming program which need to simplify, I have tested the annotated program as follow:
> #define function which will be call
> calsta <- function(c, n=100000)
+ {
+ i <- seq(from=0, length=c)
+ logx <- lchoose(NT-n, CT-i) + lchoose(n, i)
+ logmax <- max(logx)
+ logmax + log(sum(exp(logx - logmax)))
+ }
> CT=6000 #assignment to CT
>
2012 Aug 02
6
Polygon shaded area
Hi all,
I have two vectors (columns) called "efinal" and "efinal 2".
I want to plot them on the same plot and "draw" a shaded area beween the
two lines using function polygon
I have tried all but I don ?t understand the polygon area, can you help me
with examples?
plot(efinal,type="l",ylim=range(min(efinal2),
2013 Apr 23
1
Frequency Block Chart
? stato filtrato un testo allegato il cui set di caratteri non era
indicato...
Nome: non disponibile
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130423/641d9950/attachment.pl>
2009 Jul 31
1
colored 3D pillar plots
hi,
I'd like to do graphs like shown on the right panel on the following link:
http://www.clinchem.org/cgi/content/full/53/8/1544/F1
(if link doesn't work see attached file)
Any help and ideas highly appreciated, thanks in advance.
Thomas von K?nel
Human Genetics
Uni Berne