Displaying 20 results from an estimated 7000 matches similar to: "Defining reference category for a cph model summary inside of a "for" loop"
2009 Jun 17
1
function to determine to which class/category a value belongs to?
Hi all,
I''ve got a simple contingency table produced with table(), and the upper and
lower quartiles (quantile25 and quantile75) for the same dataset.
Is there a function that tells me in which category does the value of the
quartile falls into?
for example:
tabsp <- table(fam$I[fam$I>0])
1 3 6
6 1 1
and for the cumulative frequency distribution
tabcum <- cumsum(tabsp)
1 3
2007 Oct 09
3
Summary vs fivenum results for Q3
I've just started using R and am still a neophyte, but I found the following curious result. I'm using the current version of R (2.5.1 (2007-06-27) ).
Why are the results for the third quartile different in the output from the summary and fivenum commands? For the following data set
457 514 530 530 538 560 687 745 745 778 786 790 792
2011 Oct 21
1
cph/nomogram Design/RMS package hazard ratio: interquartile vs per unit
Hello,
I am constructing a nomogram using cph and nomogram commands in Dr.
Harrell's Design/RMS package. The HR that I obtain for dichotomous and
categorical variables are identical to those that I obtain using STATA
stcox. However, the inter-quartile HR I obtain for continuous variables is
obviously different, since STATA gives me HR for each unit (year,
centimeter, etc) like coxph would
2009 Aug 01
1
about the summary(cph.object)
Could someone explain the summary(cph.object)?
The example is in the help file of cph.
n <- 1000
set.seed(731)
age <- 50 + 12*rnorm(n)
label(age) <- "Age"
sex <- factor(sample(c('Male','Female'), n,
rep=TRUE, prob=c(.6, .4)))
cens <- 15*runif(n)
h <- .02*exp(.04*(age-50)+.8*(sex=='Female'))
dt <- -log(runif(n))/h
label(dt)
2010 Aug 24
3
odd behavior of "summary" function
Hello All,
Using the standard "summary" function in 'R', I ran across some odd
behavior that I cannot understand. Easy to reproduce:
Typing:
summary(c(6,207936))
Yields::
Min. *1st Qu. Median Mean 3rd Qu. Max.*
6 *51990 104000 104000 156000 207900*
None of these values are correct except for the minimum. If I perform
"quantile(c(6,
2012 Oct 17
2
loop of quartile groups
Greetings R users,
My goal is to generate quartile groups of each variable in my data set. I
would like each experiment to have its designated group added as a
subsequent column. I can accomplish this individually with the following
code:
brks <- with(data_variables,
cut2(var2, g=4))
#I don't want the actual numbers, I need a numbered group
data$test1=factor(brks,
2008 Dec 11
1
How to generate a prediction equation for a stratified survival model that was fitted by cph() in Design package
Dear all,
I used cph() function from Frank harrell's Design package to create a
survival model, then used functions 'Function' and 'sascode' to generate
prediction equation based on the saved survival model. But it failed. I
included a stratified variable in the model. If I removed the
stratification, they were working well. Does that mean that function
'Function'
2010 Oct 26
2
Forcing results from lm into datframe
Hi
I need some help getting results from multiple linear models into a dataframe.
Let me explain the problem.
I have a dataframe with ejection fraction results measured over a number of quartiles and grouped by base_study.
My dataframe (800 different base_studies) looks like
> afvtprelvefs
basestudy quartile ef ef_std entropy
CBP0908020 1 21.6 0.53 3.27
2008 Jun 13
2
Quartile regression question
I have data that looks like
lake,loglength,logweight
1,2.369215857,1.929418926
1,2.426511261,2.230448921
1,2.434568904,2.298853076
1,2.437750563,2.298853076
1,2.442479769,2.230448921
1,2.445604203,2.356025857
...
102,2.722633923,3.310268367
102,2.781755375,3.502153893
102,2.836324116,3.683407299
102,2.802773725,3.583312152
102,2.790285164,3.546419267
102,2.806179974,3.599118565
2009 Sep 22
5
use of class variable in r as in Proc means of sas
Hi,everyone i need to calculate quartile values of a variable grouped by the
other variable .
same as in aggregate function(only median,mean or functions is possible-i
think so)
Could you please help me to achieve the same for other quartile
values(5,10,25,75,90) as for median using aggregate.
Thanks in advance.
data :
zip price
60000 567000
60001 478654
60004 485647
60001
2010 Jan 22
2
Quartiles and Inter-Quartile Range
Why am I getting a wrong result for quartiles?
here is my code:
> cbiomass = c(910, 1058, 929, 1103, 1056, 1022, 1255, 1121, 1111, 1192,
> 1074, 1415)
> summary(cbiomass)
> IQR(cbiomass)
The result R gives me is:
For the summary
> Min. 1st Qu. Median Mean 3rd Qu. Max.
910 1048 1088 1104 1139 1415
For IQR
> 91.25
*********
The true Q1 is 1039
2005 Oct 04
6
boxplot statistics
I have read and reread the boxplot and the boxplot stats page, and I
still cannot understand how and what boxplot shows. I realize that
this might be due to me not knowing enough statistics, but anyway...
First, how does boxplot determine the size of the box? And is the line
inside the box the mean or the median (or something completely
different?) And how does it determine how long out the
2003 Oct 28
4
random number generation
Hi every one,
I am trying to generate a normally distributed random variable with the
following descriptive statistics,
min=1, max=99, variance=125, mean=38.32, 1st quartile=38, median=40, 3rd
quartile=40, skewness=-0.274.
I know the "rnorm" will allow me to simulate random numbers with mean 38.32
and Sd=11.18(sqrt(125)). But I need to have the above mentioned descriptive
2017 May 18
2
Bug: floating point bug in nclass.FD can cause hist() to crash
Hello everybody,
This is a bug involving functions in core R package:
graphics::hist.default, grDevices::nclass.FD, and
base::pretty.default. It is not yet on Bugzilla. I cannot submit it
myself, as I do not have an account. Could somebody else add it for
me, perhaps? That would be much appreciated.
Kind regards,
Sietse
Sietse Brouwer
Summary
-------
Floating point errors can cause a data
2017 Oct 13
2
How to define proper breaks in RFM analysis
> On Oct 13, 2017, at 2:51 AM, PIKAL Petr <petr.pikal at precheza.cz> wrote:
>
> Hi
>
> You expect us to solve your problem but you ignore advice already recieved.
>
> Your data are unreadable, use dput(yourdata) instead. see ?dput
>
>> test<-read.table("clipboard", heade=T)
> Error in scan(file = file, what = what, sep = sep, quote = quote,
2017 Oct 13
0
How to define proper breaks in RFM analysis
Hemant's problem is that the indicators are not distributed uniformly.
With a uniform distribution, categorization gives a reasonably optimal
separation of cases. One approach would be to drop categorization and
calculate the overall score as the mean of the standardized indicator
scores. Whether this is an option I do not know. I did offer an
"eyeball" set of breaks in a previous
2017 Oct 23
1
How to define proper breaks in RFM analysis
hello,
I'm confused what you guys are talking about.
i just want to set ideal threshold values for my RFM scores which can be
done using Quantiles but i don't want to use quantiles because my data is
not normally distributed so it will lead to wrong ranges of breaks. to fix
this problem I'm looking for an approach which can define the ideal range
to breaks to categorize RFM scores into
2007 Apr 06
5
Labelling boxplot with fivenumber summary
I am very new to R so forgive me if this seems basic but I have done extensive searching and failed to come up with the answer for myself.
I am trying to label a boxplot I have created with the values for the median, upper and lower quartiles and max and min values. I have been unable to do this or find anything on the net to say how it might be done. Is this possible and if so how? Regards,
2011 Nov 10
1
Removing outliers
Hi,
I want to remove the outliers of my database with the following program (an
observation is considered an outlier if it is bigger than second quartile +
1,5* distance interquartiles or less than second quartile - 1,5*distance
interquartiles):
for(i in 1:length(dados)){
q3=quantile(dados[i], probs=.75)
q3=quantile(dados[i], probs=.50)
q1=quantile(dados[i], probs=.25)
d=q3-q1
for(i2 in
2004 Feb 04
3
Various newbie questions
Hello,
1) What is the difference between a "data frame" (J H Maindonald, Using
R, p. 12) and a "vector"?
In Using R, the author asks the reader to enter the following data in a
data frame, which I will call "mydata":
year snow.cover
1970 6.5
1971 12.0
1972 14.9
1973 10.0
1974 10.7
1975 7.9
...
mydata=data.frame(year=c(1970,...),snow.cover=c(6.5,...))
2) How to