Re: [R] R 3.4.3 is released

2017-12-01 Thread Göran Broström
---- What can I do? Göran Broström On 2017-11-30 10:56, Peter Dalgaard wrote: The build system rolled up R-3.4.3.tar.gz (codename "Kite-Eating Tree") this morning. The list below details the changes in this release. You can get the source code from http://cran.r-proje

Re: [R] R 3.4.3 is released

2017-12-02 Thread Göran Broström
Removing libopenblas-dev and libopenblas-base solved my problem. Göran On 2017-12-01 18:51, Göran Broström wrote: Thanks: I installed from source and got an error when loading a package: > library(eha) Loading requi

Re: [R] question with integrate function

2018-02-06 Thread Göran Broström
uld try to integrate over a finite interval, say (7, 12). Göran Broström On 2018-02-06 19:40, li li wrote: Sorry. I meant in the previous email that the function h() is a monotone decreasing function. Thanks very much. 2018-02-06 13:32 GMT-05:00 li li : Hi all, The function h below is a functio

Re: [R] Generate random Bernoulli draws

2018-07-06 Thread Göran Broström
On 2018-07-06 19:18, Berry, Charles wrote: A liitle math goes along way. See below. On Jul 5, 2018, at 10:35 PM, Marino David wrote: Dear Bert, I know it is a simple question. But for me, at current, I fail to implement it. So, I ask for help here. It is not homework. Best, David 2018

Re: [R] Generate N random numbers with a given probability and condition

2018-07-12 Thread Göran Broström
On 2018-07-05 00:21, Nelly Reduan wrote: Dear all, I would like to generate N random numbers with a given probability and condition but I'm not sure how to do this. For example, I have N = 20 and the vector from which to choose is seq(0, 10, 1). I have tested: x <- sample(seq(0, 10, 1), 20

[R] R-3.4.0 and survival_2.41-3

2017-04-25 Thread Göran Broström
I installed R-3.4.0 and got problems with the survival package, for instance > library(survival) > mort <- data.frame(exit = 1:4, event = rep(1, 4), x = c(0, 1, 0, 1)) > fit <- coxph(Surv(exit, event) ~ x, data = mort) Error in fitter(X, Y, strats, offset, init, control, weights = we

Re: [R] R-3.4.0 and survival_2.41-3 ..

2017-04-25 Thread Göran Broström
Thanks Martin, that helped! Göran On 2017-04-25 10:34, Martin Maechler wrote: Göran Broström on Tue, 25 Apr 2017 10:22:48 +0200 writes: > I installed R-3.4.0 and got problems with the survival package, for instance > >> library(survival)

Re: [R] R-3.4.0 and survival_2.41-3 ..

2017-04-25 Thread Göran Broström
Right, normally this is how it works for me when I install R from source. In this case, on this computer, I use the debian/ubuntu packaging, and then it is necessary to 'rebuild' packages, obviously. Thanks, Göran On 2017-04-25 12:20, Viechtbauer Wolfgang (SP) wrote: Sort of an obvious approa

Re: [R] R-3.4.0 and survival_2.41-3 ..

2017-04-25 Thread Göran Broström
On 2017-04-25 10:34, Martin Maechler wrote: Göran Broström on Tue, 25 Apr 2017 10:22:48 +0200 writes: > I installed R-3.4.0 and got problems with the survival package, for instance > >> library(survival) >> mort <- data.frame(exit =

Re: [R] [FORGED] Re: How create columns for squared values from previous columns?

2017-04-29 Thread Göran Broström
On 2017-04-29 06:45, Mike C wrote: Thanks Rolf. I was just a bit frustrated that R wouldn't generate dummy variable names on the fly. Also, another question, if I want to put column 5 at column 3, dat[, 3:5] <- dat[, c(5,3,4)] It does not work, why? It "works", but you need to shuffle the

Re: [R] Fill in empty cell in data.frame from previous value

2017-06-25 Thread Göran Broström
> library(tidyr) > ?fill Göran On 2017-06-24 19:49, Christophe Elek wrote: Hello Total newbie here... I hope I read the guide properly I have the following data.frame (I read it from a CSV file I cannot change) names val 1 Mandy 1 2 2 3 John2 4 2 I want to read the r

Re: [R] Question about correlation

2017-07-05 Thread Göran Broström
On 2017-07-05 11:56, Jim Lemon wrote: Hi Chin Yi, If you are trying to correlate "Health" with "Disease", i.e. cydf<-read.table(text="OTU ID Health Disease Bacterial 1 0.29 0.34 Bacterial 2 0.25 0.07 Bacterial 3 0.06 0.06 Bacterial 4 0.07 0.09 Bacterial 5 0.02 0.05", header=TRU

Re: [R] Question about correlation

2017-07-06 Thread Göran Broström
thing about correlation networks, but by googling I found two R packages, ggraph and corrr, that may be of interest to you. Göran On Thu, Jul 6, 2017 at 1:38 AM, Göran Broström <mailto:goran.brost...@umu.se>> wrote: On 2017-07-05 11:56, Jim Lemon wrote: Hi Chin Yi,

Re: [R] Can I increase the size of an asterisk in plotmath()?

2016-06-30 Thread Göran Broström
Rolf, text(7.5,2.5,expression(paste(bolditalic(p),"*", sep = ""))) looks quite nice. On my Mac at least. Göran On 30/06/16 02:38, Rolf Turner wrote: I am trying to plot an expression of the form "p^*" --- a bold letter p with the asterisk as a superscript. I can get *something* with code of

Re: [R] conditional gap time frailty cox model for recurrent events

2016-09-05 Thread Göran Broström
Dear Elisabetta, I have no direct answer to your question, but a suggestion: Use the 'coxme' function (in the package with the same name). In the help page for 'frailty' (survival) you will find: "The coxme package has superseded this method. It is faster, more stable, and more flexible." Ht

Re: [R] prmatrix and print.matrix

2015-06-26 Thread Göran Broström
On 06/25/2015 11:18 PM, Therneau, Terry M., Ph.D. wrote: The help page for prmatrix states that it only exists for backwards compatability and strongly hints at using print.matrix instead. However, there does not seem to be a print.matrix() function.' I asked this very same question here

Re: [R] R wont accept my zero count values in the GLM with quasi_poisson dsitribution

2015-07-28 Thread Göran Broström
On 28/07/15 08:33, Charlotte wrote: Hello I have count values for abundance which follow a pattern of over-dispersal with many zero values. I have read a number of documents which suggest that I don't use data transforming methods but rather than I run the GLM with the quasi poisson distribut

Re: [R] elegant way to remove cases with many different ids

2015-01-23 Thread Göran Broström
On 2015-01-23 11:09, Ivan Calandra wrote: Hi Alain, I think you're looking for %in% (see ?'%in%' for the help page) id.vector <- c(1,3) ## here you define the values you want to select: x, y, z... subset(df, id %in% id.vector) But note the Warning in >?subset Göran HTH, Ivan -- Ivan

Re: [R] get latest dates for different people in a dataset

2015-01-25 Thread Göran Broström
On 2015-01-24 01:14, William Dunlap wrote: Here is one way. Sort the data.frame, first by Name then break ties with CheckInDate. Then choose the rows that are the last in a run of identical Name values. I do it by sorting by the reverse order of CheckinDate (last date first) within Name, then

Re: [R] get latest dates for different people in a dataset

2015-01-25 Thread Göran Broström
result, Z[[1]]$result)) # f2 f3 f4 #TRUE TRUE TRUE Note that the various functions give different results if any patient comes in twice on the same day. f4 includes both visits in the ouput, the other include either the first or last (as ordered in the original file). Bill Dunlap TIBCO Softw

[R] corrupted double-linked list

2015-01-29 Thread Göran Broström
Hello, A weird thing happened to me while I was playing around in the R console with a data frame ('fert'). The finale was - > with(fert[fert$parity == 4, ], table(age, event)) event age 0 1 2 (14,20] 0 0 0 (20,

Re: [R] corrupted double-linked list

2015-01-29 Thread Göran Broström
On 2015-01-29 12:42, Duncan Murdoch wrote: On 29/01/2015 6:24 AM, Göran Broström wrote: Hello, A weird thing happened to me while I was playing around in the R console with a data frame ('fert'). The finale was - > with(fer

Re: [R] Replace the value with 1 and 0

2015-02-26 Thread Göran Broström
On 2015-02-26 00:33, JS Huang wrote: Hi, Here is an implementation. More data are added. An extra column hasRain is added instead of replacing column Amount. rain Year Month Day Amount 1 1950 1 10.0 2 1950 1 2 35.5 3 1950 1 3 17.8 4 1950 1 4 24

Re: [R] Mysterious seg fault.

2018-08-11 Thread Göran Broström
Rolf, have you tried to run R with a debugger, as in $ R -d gdb the gnu debugger? G, On 2018-08-11 23:12, Rolf Turner wrote: I am getting a seg fault from a package that I am working on, and I am totally flummoxed by it.  The fault presumably arises from dynamically loaded Fortran code, b

Re: [R] Question on Binom.Confint

2018-09-14 Thread Göran Broström
On 2018-09-14 17:04, Guo, Fang (Associate) wrote: I did use library(binom). However, I was able to use the method "lrt" which is short for likelihood ratio test. You are right, there is a method "lrt", but it is not mentioned in the documentation. (Look at the code.) Göran -Origina

Re: [R] Select

2019-02-11 Thread Göran Broström
On 2019-02-11 23:35, Val wrote: Hi all, I have a data frame with tow variables group and its size. mydat<- read.table( text='group count G1 25 G2 15 G3 12 G4 31 G5 10' , header = TRUE, as.is = TRUE ) How about x <- sample(1:5) total <- mydat$count[x[1]] i <- 1 while (total < 40){

Re: [R] Changing date format

2014-10-07 Thread Göran Broström
On 2014-10-07 11:27, Jim Lemon wrote: On Tue, 7 Oct 2014 10:32:42 AM Frederic Ntirenganya wrote: Dear All, How can I change the format of date of day of the year ? for example r (i.e. "17 Apr" rather than "108"). The following is the type of the dataset I have head(Samaru) Year Start E

Re: [R] Survival Analysis and Predict time-to-death

2015-08-18 Thread Göran Broström
al with linear predictor lp. A useful alternative is simulation (use 'rweibull') or numerical integration, especially for estimating remaining expected life 'later in life'. And for other distributions than the Weibull. Göran Broström (author of the eha package) ___

Re: [R] using survreg() in survival package with "long" data

2015-08-29 Thread Göran Broström
Dear John, I think you are missing that 'survreg' does not handle left truncated data. With that you should use the 'eha' package, for a PH model the function 'phreg', and for an AFT model the function 'aftreg' (you didn't tell which model you want to fit). Your attempt with the 'survreg' functi

Re: [R] using survreg() in survival package with "long" data

2015-08-30 Thread Göran Broström
On 08/29/2015 11:56 PM, Fox, John wrote: Dear Göran, Thank you for responding to my query; please see below: -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Göran Broström Sent: August 29, 2015 3:59 PM To: r-help@r-project.org Subject: Re: [R] using

Re: [R] Plot step function

2016-02-06 Thread Göran Broström
c(rep(0,3),rep(1,3)) sfun0 <- stepfun(-2:2, y0, right=TRUE) plot(sfun0) I would like to suggest the correct way: Replace the last line by > plot(sfun0, verticals = FALSE) Göran Broström __ R-help@r-project.org mailing list -- To UNSUBSCRIB

Re: [R] Help for survival curves for the survfit object‏

2016-02-08 Thread Göran Broström
On 2016-02-08 14:11, 于慧琳 wrote: Hi guy,I have some problems when plotting survival curves for the survfit object.My survfit model is as follows:fit6<-survfit(Surv(Survival_time_year_,event)~Race_1_Desc,data=data6)Race_1_Desc is a indicator variable which has 0 and 1 values.However, in my datase

[R] Dates and missing values

2016-02-08 Thread Göran Broström
he second case? 'is.na' gives the correct (same) numbers. Can I somehow force 'summary' to print NA's? I found no clues in the documentation. > sessionInfo() R version 3.2.3 Patched (2016-01-19 r69960) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 15.1

Re: [R] Dates and missing values

2016-02-08 Thread Göran Broström
Thanks Marc, but see below! On 2016-02-08 19:26, Marc Schwartz wrote: On Feb 8, 2016, at 11:26 AM, Göran Broström wrote: I have a data frame with dates as integers: summary(persons[, c("foddat", "doddat")]) foddat doddat Min. :1679 Min

Re: [R] Convergence issues when using ns splines (pkg: spline) in Cox model (coxph) even when changing coxph.control

2016-03-30 Thread Göran Broström
if necessary) and just a few cases, but enough to show your problem. Göran Broström > I use survival and spline package to create the Cox model and cubic splines respectively. Without the interaction term and/or spline, I have no convergence problem. I read some forums about changing the

Re: [R] Convergence issues when using ns splines (pkg: spline) in Cox model (coxph) even when changing coxph.control

2016-03-30 Thread Göran Broström
On 2016-03-30 23:06, David Winsemius wrote: On Mar 29, 2016, at 1:47 PM, Jennifer Wu, Miss wrote: Hi, I am currently using R v3.2.3 and on Windows 10 OS 64Bit. I am having convergence issues when I use coxph with a interaction term (glarg*bca_py) and interaction term with the restricted c

[R] Improper configuration

2016-04-29 Thread Göran Broström
Trying https://cran.r-project.org got me "The owner of cran.r-project.org has configured their website improperly" If I try http (instead of https) I'm redirected to www.project.org ("Project America") Any ideas? Göran Broström __

Re: [R] Improper configuration

2016-04-29 Thread Göran Broström
Or the new install needs some warming-up. Thanks Bert, Göran Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Fri, Apr 29, 2016 at

Re: [R] problem installing R 2.5

2016-11-07 Thread Göran Broström
libX11-dev? Göran On 2016-11-07 19:27, Lentes, Bernd via R-help wrote: Hi, i'd like to install R 2.5 on an Ubuntu 14.04. I have a special software requiring this old version. While ./configure, i get the following error: checking for mbstate_t... yes checking for X... no configure: error: --

Re: [R] Likelihood ratio test between glm and glmer fits

2008-07-19 Thread Göran Broström
. >>>> Any help would be appreciated. >>>> >>>> Corey >>>> >>>> Corey S. Sparks, Ph.D. >>>> >>>> Assistant Professor >>>> Department of Demography and Organization Studies >>>> University of

Re: [R] Parametric survival models with left truncated, right censored data

2008-07-20 Thread Göran Broström
...{{dropped:9}} > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained

Re: [R] AFTREG with ID argument

2010-02-18 Thread Göran Broström
2010/2/18 Philipp Rappold : > Göran, David, > > in order to adapt aftreg to my needs I wrote a little function that I would > like to share with you and the community. I once promised to fix this 'asap'. Now I promise to do it tonight. OK? Göran > > > WHAT DOES IT FIX? > > (1) Using the id-argum

Re: [R] Extract p-value from aftreg object

2010-02-18 Thread Göran Broström
rom 'aftreg'. You could try the same. Thanks > Philipp > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html &

[R] Error using update.packages

2010-02-19 Thread Göran Broström
LC_MESSAGES=sv_SE [7] LC_PAPER=sv_SE LC_NAME=CLC_ADDRESS=C [10] LC_TELEPHONE=C LC_MEASUREMENT=sv_SE LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and

Re: [R] Accelerated failure time interpretation of coefficients

2010-02-23 Thread Göran Broström
Philipp Rappold wrote: Dimitris, thanks for your detailled answer and the literature recommendation. However, I'm still wondering about the interpretation of coefficients in the AFT model with time-varying covariates. The precise question is: How can I interpret a "single" coefficient if my a

Re: [R] AFT-model with time-dependent covariates

2009-10-20 Thread Göran Broström
ing-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> >> > > ______ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://w

Re: [R] AFT-model with time-varying covariates and left-truncation

2010-01-29 Thread Göran Broström
___ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Göran Broström __

Re: [R] AFTREG with ID argument

2010-02-05 Thread Göran Broström
l the best > Philipp > > ______ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained,

Re: [R] Using coxph with Gompertz-distributed survival data.

2010-02-05 Thread Göran Broström
er time is approached.  The > program should give an error.  For one, why do you assume the change is > linear in time?  This is rather rare.  You might look at the timedep > package. > > 5. Some actual advice -- if you think it is Gompertzian why not fit a > Gompertz distribution? >

Re: [R] Contrasts in coxph

2021-04-06 Thread Göran Broström
Dear John, I googled "contrasts Cox regression" and found https://stats.stackexchange.com/questions/15603/performing-contrasts-among-treatment-levels-in-survival-analysis where Frank Harrell reports how to do what you want with his rms package. At least I think so, haven't tried it myself. B

Re: [R] Plotting adjusted KM curve

2021-04-09 Thread Göran Broström
On 2021-04-05 03:34, Sorkin, John wrote: Colleagues, I am using the coxph to model survival time. How do I plot an adjusted Kaplan Meir plot resulting from coxph? The code I would like to run would start with: # run cox model fit1Cox <- coxph(surv_object ~age+sex,data=mydata) I have no idea

Re: [R] density with weights missing values

2021-07-13 Thread Göran Broström
Den 2021-07-12 kl. 15:09, skrev Matthias Gondan: Weighted mean behaves differently: One difference is that density has a named argument 'weights' not present in weighted.mean, which instead has 'w' for weights. Annoying. So, in your examples, the argument 'weights = ' is always ignored, a

[R] zero weights in weighted.mean

2021-07-14 Thread Göran Broström
I wonder about the last sentence in the Details section of the documentation of 'weighted.mean': "However, zero weights _are_ handled specially and the corresponding ‘x’ values are omitted from the sum." The return value of weighted.mean.default is sum((x * w)[w != 0])/sum(w) and indeed, it

Re: [R] zero weights in weighted.mean

2021-07-14 Thread Göran Broström
Den 2021-07-14 kl. 13:16, skrev Duncan Murdoch: On 14/07/2021 6:00 a.m., Göran Broström wrote: I wonder about the last sentence in the Details section of the documentation of 'weighted.mean': "However, zero weights _are_ handled specially and the corresponding ‘x’ values a

Re: [R] zero weights in weighted.mean

2021-07-14 Thread Göran Broström
e) 410-605-7119 (Fax) 410-605-7913 (Please call phone number above prior to faxing) ____ From: R-help on behalf of Göran Broström Sent: Wednesday, July 14, 2021 10:46 AM To: Duncan Murdoch; r-help@r-project.org Subject: Re: [R] zero weights in weighted.mean

[R] is.na()<- on a character vector

2022-12-16 Thread Göran Broström
I'm confused: > x <- 1:2 > is.na(x) <- 1 > x [1] NA 2 OK, but > x <- c("A", "B") > is.na(x) <- "A" > x A "A" "B" NA What happens? G_ran __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mai

Re: [R] is.na()<- on a character vector

2022-12-16 Thread Göran Broström
Yes, I was confused: In is.na(x) <-value, value is supposed to be an index vector, clearly stated on the help page. So Bert�s suggestion is the way to go. Thanks to all, G�ran -Ursprungligt meddelande- Fr�n: Bill Dunlap Datum: fredag, 16 december 2022 20:15 Till: G�ran Brostr�m Kopia:

Re: [R] is.na()<- on a character vector

2022-12-17 Thread Göran Broström
x[ is.na( x ) ] <- 1 should have no effect on x. On December 16, 2022 10:28:52 AM PST, "Göran Broström" wrote: I'm confused: x <- 1:2 is.na(x) <- 1 x [1] NA 2 OK, but x <- c("A", "B") is.na(x)

[R] Integer division

2022-12-19 Thread Göran Broström
I have a long vector x with five-digit codes where the first digit of each is of special interest, so I extracted them through > y <- x %/% 1 but to my surprise y contained the value -1 in some places. It turned out that x contains -1 as a symbol for 'missing value' so in effect I found t

Re: [R] Integer division

2022-12-19 Thread Göran Broström
Den 2022-12-19 kl. 15:41, skrev Martin Maechler: Göran Broström on Mon, 19 Dec 2022 14:22:00 +0100 writes: > I have a long vector x with five-digit codes where the > first digit of each is of special interest, so I extracted > them through >> y

Re: [R] Integer division

2022-12-19 Thread Göran Broström
so we deduce that R *neither* rounds *not* truncates, but returns the floor of the quotient. It is widely argued that flooring division is more generally useful than rounding or truncating division, but it is admittedly surprising. On Tue, 20 Dec 2022 at 02:51, Göran Broström <mailto:g...@ehar.

[R] web address for R-project

2023-03-09 Thread Göran Broström
I got the link cran.nexr.com from a person who claimed that it is the home of R-project, and indeed, it looks right. But it doesn't feel right, so I wonder what is going on. Is it someone's mirror (authorized) of R-project? Thanks, Göran __ R-help@

Re: [R] web address for R-project

2023-03-09 Thread Göran Broström
Thanks, Göran Den 2023-03-09 kl. 15:01, skrev Ivan Krylov: В Thu, 9 Mar 2023 14:43:49 +0100 Göran Broström пишет: Is it someone's mirror (authorized) of R-project? It's not currently in the official list of mirrors [*], but anyone can create a CRAN mirror for their own needs

[R] Creating methods

2023-04-24 Thread Göran Broström
I am reading Hadley's "Advanced R", Section 13.4.3 (https://adv-r.hadley.nz/s3.html). It starts There are two wrinkles to be aware of when you create a new method: First, you should only ever write a method if you own the gene

Re: [R] Creating methods

2023-04-24 Thread Göran Broström
Den 2023-04-24 kl. 15:14, skrev Ivan Krylov: В Mon, 24 Apr 2023 15:07:50 +0200 Göran Broström пишет: First, you should only ever write a method if you own the generic or the class. I was stunned when I read it. I write methods all over the place for generics like print, summary, plot, etc

Re: [R] saving an R script

2019-05-10 Thread Göran Broström
?dump Den 2019-05-10 kl. 04:54, skrev David Winters: Greetings, This is a super embarrassing question. But, how do you save an R script with code? that is, not doing it the cheat way? where you just hit the "save" button? what function would it be? I know how to save the environment in code:

[R] Object and file sizes

2019-06-28 Thread Göran Broström
Hello, I have two large data frames, 'liss' (170 million obs, 8 variables) and 'fobb' (52 million obs, 8 variables, same as for 'liss'), and checking their sizes I get > object.size(liss) 7477492552 bytes > object.size(fobb) 2494591736 bytes Fair enough, but when I save them to disk (saveRDS

Re: [R] Object and file sizes

2019-06-28 Thread Göran Broström
On 2019-06-28 15:26, Duncan Murdoch wrote: On 28/06/2019 7:35 a.m., Göran Broström wrote: Hello, I have two large data frames, 'liss' (170 million obs, 8 variables) and 'fobb' (52 million obs, 8 variables, same as for 'liss'), and checking their sizes I get  

Re: [R] results of a survival analysis change when converting the data to counting process format

2019-08-22 Thread Göran Broström
On 2019-08-18 19:10, Ferenci Tamas wrote: Dear All, Consider the following simple example: library( survival ) data( veteran ) coef( coxph(Surv(time, status) ~ trt + prior + karno, data = veteran) ) trtpriorkarno 0.180197194 -0.005550919 -0.033771018 Note that w

Re: [R] results of a survival analysis change when converting the data to counting process format

2019-08-23 Thread Göran Broström
Den 2019-08-22 kl. 21:48, skrev Göran Broström: On 2019-08-18 19:10, Ferenci Tamas wrote: Dear All, Consider the following simple example: library( survival ) data( veteran ) coef( coxph(Surv(time, status) ~ trt + prior + karno, data = veteran) )   trt    prior    karno

Re: [R] Calling a LAPACK subroutine from R

2019-09-11 Thread Göran Broström
Giovanni, you are trying to open a can of worms. Se recent discussions on R-pkg-devel, Writing R Extensions, and the help page for .Fortran. Best, Göran On 2019-09-10 23:44, Giovanni Petris wrote: Hello R-helpers! I am trying to call a LAPACK subroutine directly from my R code using .Fort

Re: [R] Extracting values from Surv function in survival package

2024-05-16 Thread Göran Broström
Hi Dennis, look at the help page for summary.survfit, the Value n.event. Göran On 2024-05-15 22:41, Dennis Fisher wrote: OS X R 4.3.3 Colleagues I have created objects using the Surv function in the survival package: FIT.1 Call: survfit(formula = FORMULA1)

[R] round and trailing zero

2024-07-29 Thread Göran Broström
I have a "result": > hazards (60, 70](70, 80](80, 90] (90, 100] [1,] 0.046612937 0.115643783 0.273613266 0.450127975 Two issues: (i) Too many decimals, and (ii) it seems to be an 1x4 matrix, I only need the first row. (i): > haz <- round(hazards, 3) > haz (60, 70] (70,

Re: [R] round and trailing zero

2024-07-29 Thread Göran Broström
Ah, thanks, Göran > 29 juli 2024 kl. 16:23 skrev Duncan Murdoch : > > On 2024-07-29 10:06 a.m., Göran Broström wrote: >> I have a "result": >> > hazards >> (60, 70](70, 80](80, 90] (90, 100] >> [1,] 0.046612937 0.115643783 0.273

Re: [R] round and trailing zero

2024-07-30 Thread Göran Broström
Den 2024-07-30 kl. 17:09, skrev Jorgen Harmse: Duncan Murdoch answered your question, but I have another. Are you going to do some computation with the rounded numbers, Wouldn't dream of it. or are they just for display? Yes. G, (One thing I like about Excel is that I can change the

Re: [R] Survival analysis

2020-04-21 Thread Göran Broström
Dear dr Medic, Den 2020-04-17 kl. 23:03, skrev Medic: On 2020-04-17 20:06, Medic wrote: I can't understand how to do a survival analysis (?Surv ()) when some event occurred before the start of observation (left censored). If I understand correctly, there are two methods. I chose a method with:

[R] Windows 7 (Swedish): 'Rcmd INSTALL' fails

2013-07-20 Thread Göran Broström
spite my effort to change it), so I tried the same thing with an English version of Windows 7 (on another machine), and there everything went as expected. I installed R on both machines today so the setups should be identical, except for the languages. What can be wrong? Can it be a language/path

Re: [R] Windows 7 (Swedish): 'Rcmd INSTALL' fails (SOLVED)

2013-07-21 Thread Göran Broström
ssion problem. This was strange, because I am the administrator of my Windows machines. BTW, why can't I, as an administrator, install packages in "C:\Program Files\R\R-3.0.1\library" ? This is of course a very minor problem, since I never do anything useful on Windows machines.

Re: [R] Windows 7 (Swedish): 'Rcmd INSTALL' fails (SOLVED)

2013-07-21 Thread Göran Broström
On 07/21/2013 12:27 PM, Uwe Ligges wrote: On 21.07.2013 10:50, Göran Broström wrote: Uwe, thanks! The switch from "Program" to "Program Files" made it (stupid Windows!). I tried the "--library=." flag because I got the error message path[2]="C:/Progra

Re: [R] Repeated measures Cox regression ??coxph??

2013-07-25 Thread Göran Broström
On 07/26/2013 04:06 AM, John Sorkin wrote: David Thank you for your thoughts. The data I am analyzing do not come from a clinical trial but rather from a cohort study whose aim is to determine risk factors for surgical therapy to treat their joints. John As David explained, there are several wa

Re: [R] coxph diagnostics

2013-08-11 Thread Göran Broström
On 08/11/2013 06:14 AM, Soumitro Dey wrote: Hello all, This may be a naive question but since I'm new to R/survival models, I cannot figure it out the problem myself. I have a coxph model for my data and I am trying to test if the proportional hazards assumption holds. Using cox.zph on the mo

Re: [R] Repeated measures Cox regression ??coxph??

2013-08-16 Thread Göran Broström
Sorry I'm late with this. On 07/26/2013 02:02 PM, Terry Therneau wrote: Two choices. If this were a linear model, do you like the GEE approach or a mixed effects approach? Assume that "subject" is a variable containing a per-subject identifier. GEE approach: add "+ cluster(subject)" to the mode

[R] Moderated list?

2013-02-05 Thread Göran Broström
I've been away from this list but reentered recently. Now when I send a question I get an automated answer saying: --- Your mail to 'R-help' with the subject .. Is being held until the list moderator can review it for approval. The reason it is being held: Post to mod

[R] integrate: Don't do this?

2013-02-05 Thread Göran Broström
When I run the following function HQ2 <- function(n) { nv <- 6 * sqrt(n) fcn <- function(z) { pchisq(z^2 / 36, n - 1) * dnorm(nv - z) } ## I want the integral from 0 to infinity: f.Inf <- integrate(fcn, 0, Inf) ## Doc: "Don't do this": f.100 <- integrat

Re: [R] integrate: Don't do this?

2013-02-06 Thread Göran Broström
e length. Maybe the advice in the documentation about "integrating over infinite intervals" needs some modification? Göran On 02/05/2013 07:42 PM, Göran Broström wrote: When I run the following function HQ2 <- function(n) { nv <- 6 * sqrt(n) fcn <- function(z)

Re: [R] Help on indicator variables

2013-03-21 Thread Göran Broström
On 03/21/2013 02:08 PM, Jorge I Velez wrote: Try ifelse(ABS ==1 | DEFF == 1, 1, 0) or as.numeric(ABS | DEFF) (faster?) Göran HTH, Jorge.- On Fri, Mar 22, 2013 at 12:02 AM, Tasnuva Tabassum wrote: I have two indicator variables ABS and DEFF. I want to create another indicator variabl

Re: [R] 'rms' package error

2014-04-03 Thread Göran Broström
HELP-td3494640.html Does anyone know how to get this function to work? Or if there is an alternative package that can implement a Weibull PH model? The function 'phreg' in the package 'eha' fits parametric PH models to right-censored and left-truncated data for some baseli

Re: [R] Trend test for hazard ratios

2014-04-15 Thread Göran Broström
On 04/15/2014 05:00 AM, r-help-requ...@r-project.org wrote: Hello, I have the following problem. I stratified my patient cohort into three ordered groups and performed multivariate adjusted Cox regression analysis on each group separately. Now I would like to calculate a p for trend across the h

Re: [R] Trend test for hazard ratios

2014-04-16 Thread Göran Broström
On 04/15/2014 10:51 PM, David Winsemius wrote: On Apr 15, 2014, at 6:32 AM, Therneau, Terry M., Ph.D. wrote: You can do statistical tests within a single model, for whether portions of it fit or do not fit. But one cannot take three separate fits and compare them. The program needs context t

[R] Precedence and parentheses

2014-05-06 Thread Göran Broström
A thread on r-devel ("Historical NA question") went (finally) off-topic, heading towards "Precedence". This triggered a question that I think is better put on this list: I have been more or less regularly been writing programs since the seventies (Fortran, later C) and I early got the habit of

Re: [R] Difference in coefficients in Cox proportional hazard estimates between R and Stata, why?

2014-05-30 Thread Göran Broström
In the Cox regression case, the probable explanation is that you have ties in your data; Stata and coxph may have different defaults for handling ties. Read the manuals! The difference in sign in the other cases is simply due to different definitions of the models. I am sure it is well documen

Re: [R] read a file of text with read.table

2014-06-26 Thread Göran Broström
Carol, while sep="" is the default, it really means 'whitespace', see the documentation of 'sep'. Göran Broström On 2014-06-26 11:21, carol white wrote: Hi, with read.fwf, it works. But I still don't understand why it doesn't work with read.table

Re: [R] Predictions from "coxph" or "cph" objects

2014-07-06 Thread Göran Broström
on, and therefore it is better to stick to medians and quantiles. Göran Broström On 2014-07-06 06:17, David Winsemius wrote: On Jul 5, 2014, at 9:12 PM, David Winsemius wrote: On Jul 5, 2014, at 12:43 PM, Axel Urbiz wrote: Thank you David. It is my understanding that using survfirsurvit

Re: [R] Predictions from "coxph" or "cph" objects

2014-07-06 Thread Göran Broström
On 2014-07-06 10:48, Göran Broström wrote: David and Axel, I have two comments to your discussion: (i) The area under the survival curve is equal to the mean of the distribution, so the estimate of the mean should be the sum of the areas of the rectangles defined by the estimated survival

Re: [R] Predictions from "coxph" or "cph" objects

2014-07-08 Thread Göran Broström
On 2014-07-06 11:17, Göran Broström wrote: On 2014-07-06 10:48, Göran Broström wrote: David and Axel, I have two comments to your discussion: (i) The area under the survival curve is equal to the mean of the distribution, so the estimate of the mean should be the sum of the areas of the

[R] seq_len and loops

2013-12-21 Thread Göran Broström
t; ncol(x)){ i <- i + 1 What is "good practice" (efficient and safe)? Göran Broström __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/

Re: [R] cumulative incidence for mstate in Survival package in R

2013-12-31 Thread Göran Broström
II. Problem 2: I try using an example from sourcecode.pdf: fit <- survfit(Surv(time, status, type=’mstate’) ~ sex, data=mine) but where can I have the 'mine' data? Thank you! Where do you find 'sourcecode.pdf'? Göran Broström Best, Jieyue ___

Re: [R] cumulative incidence for mstate in Survival package in R

2013-12-31 Thread Göran Broström
On 12/31/2013 09:05 PM, Jieyue Li wrote: Thanks a lot for the reply! On Tue, Dec 31, 2013 at 1:59 AM, Göran Broström mailto:goran.brost...@umu.se>> wrote: On 12/30/2013 11:04 PM, Jieyue Li wrote: Dear All, I want to have the cumulative incidence curves for 'm

Re: [R] seq_len and loops

2013-12-31 Thread Göran Broström
.@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Duncan Murdoch Sent: Saturday, December 21, 2013 3:52 PM To: Göran Broström; R-help@r-project.org Subject: Re: [R] seq_len and loops On 13-12-21 6:50 PM, Duncan Murdoch wrote: On 13-12-21 5:57 PM, Göran Broström wrote: I was rec

Re: [R] seq_len and loops

2014-01-02 Thread Göran Broström
ur point; I however never have an 'else' part in this context (if x == 1 I'm already done). Another observation: The 'while (x < n) x <- x + 1' approach is very slow compared to a for loop. Göran Broström Bill Dunlap Spotfire, TIBCO Software wdunlap

  1   2   >