Displaying 20 results from an estimated 2000 matches similar to: "comparing lm(), survreg( ... , dist="gaussian") and survreg( ... , dist="lognormal")"
2008 Apr 25
3
Use of survreg.distributions
Dear R-user:
I am using survreg(Surv()) for fitting a Tobit model of left-censored longitudinal data. For logarithmic transformation of y data, I am trying use survreg.distributions in the following way:
tfit=survreg(Surv(y, y>=-5, type="left")~x + cluster(id), dist="gaussian", data=y.data, scale=0, weights=w)
my.gaussian<-survreg.distributions$gaussian
2003 Feb 27
2
interval-censored data in survreg()
I am trying to fit a lognormal distribution on interval-censored
data. Some of my intervals have a lower bound of zero.
Unfortunately, it seems like survreg() cannot deal with lower
bounds of zero, despite the fact that plnorm(0)==0 and
pnorm(-Inf)==0 are well defined. Below is a short example to
reproduce the problem.
Does anyone know why survreg() must behave that way?
Is there an alternate
2007 Oct 03
1
offset in survreg
Hello,
I have a question regarding the use of an offset term with survreg(),
in the Survival library. In particular, I am trying to figure out on
what scale the offset term should be.
Here's a simple example with no censoring and no coefficients:
---------
y = rlnorm(1000, meanlog = 10, sdlog = 2)
delta = rep(1, 1000)
int = rep(1, 1000)
survreg(Surv(y,delta)~offset(10*int), dist =
2010 Sep 15
1
optim with BFGS--what may lead to this, a strange thing happened
Dear R Users
on a self-written function for calculating maximum likelihood probability (plz
check function code at the bottom of this message), one value, wden, suddenly
jump to zero. detail info as following:
w[11]=2.14
lnw =2.37 2.90 3.76 ...
regw =1.96 1.77 1.82 ....
wden=0.182 0.178 0.179...
w[11]=2.14
lnw=2.37 2.90 3.76 ...
regw =1.96 1.77 1.82 ....
wden=0.182
2007 Oct 12
2
accessing ylim set by xyplot
Hello,
I would like to know if there is a clever way to avoid the problem
illustrated below within the xyplot function.
x <- seq(1:10)
y <- seq(1:10)
pr1 <- xyplot(x ~ y)
u <- seq(1:12)
v <- seq(1:12)
pr2 <- xyplot(u ~ v, col = "red", more = FALSE)
prts <- list(pr1, pr2)
for(i in prts) print(i, more = TRUE)
I realize that one possibility is to
2009 Jun 01
1
survreg.distributions() error
Hi there.
I am receiving an unexpected error message when creating a new
distribution for the survreg() function in the survival package. I
understand the survival.distributions() function and have been
following the Cauchy example provided in the help file.
My goal is to use survreg to fit a gamma distribution to interval
censored data.
Here is a simple example of what I'm trying to do.
2004 Nov 01
1
plot time series / dates (basic)
Dear R users,
I'm having a hard time with some very simple things. I have a time
series where the dates are in the format 7-Oct-04. I imported the
file with read.csv so the date column is a factor. The series is
rather long and I want to plot it piece by piece. The function below
works fine, except that the labels for date are meaningless (ie
9.47e+08 or 1098000000 - apparently the number of
2011 Jan 28
1
survreg 3-way interaction
> I was wondering why survreg (in survival package) can not handle
> three-way interactions. I have an AFT .....
You have given us no data to diagnose your problem. What do you mean
by "cannot handle" -- does the package print a message "no 3 way
interactions", gives wrong answers, your laptop catches on fire when you
run it, ....?
Also, make sure you read
2011 Apr 09
1
loop and sapply problem, help need
Dear R experts
Sorry for this question
M1 <- 1:10
lcd1 <- c(11, 22, 33, 44, 11, 22, 33, 33, 22, 11)
lcd2 <- c(22, 11, 44, 11, 33, 11, 22, 22, 11, 22)
lcd3 <- c(12, 12, 34, 14, 13, 12, 23, 23, 12, 12)
#generating variables through sampling
pvec <- c("PR1", "PR2", "PR3", "PR4", "PR5", "PR6", "PR7",
2008 Dec 23
6
Interval censored Data in survreg() with zero values!
Hello,
I have interval censored data, censored between (0, 100). I used the
tobit function in the AER package which in turn backs on survreg.
Actually I'm struggling with the distribution. Data is asymmetrically
distributed, so first choice would be a Weibull distribution.
Unfortunately the Weibull doesn't allow for zero values in time data,
as it requires x > 0. So I tried the
2009 Jan 28
3
initial value in 'vmmin' is not finite
Dear r helpers
I run the following code for nested logit and got a message that
Error in optim(c(0, 0, 0, 0, 0.1, -2, -0.2), fr, hessian = TRUE, method = "BFGS") : initial value in 'vmmin' is not finite
What does this mean? and how can I correct it?
Thank you
June
> yogurt = read.table("yogurtnp.csv", header=F,sep=",")> attach(yogurt)>
2011 Sep 03
2
ROCR package question for evaluating two regression models
Hello All,
I have used logistic regression glm in R and I am evaluating two models both learned with glm but with different predictors. model1 <- glm (Y ~ x4+ x5+ x6+ x7, data = dat, family = binomial(link=logit))model2 <- glm (Y~ x1 + x2 +x3 , data = dat, family = binomial(link=logit))
and I would like to compare these two models based on the prediction that I get from each model:
pred1 =
2009 Mar 02
1
initial gradient and vmmin not finite
Dear Rhelpers
I have the problem with initial values, could you please tell me how to solve it?
Thank you
June
> p = summary(maxLik(fr,start=c(0,0,0,1,0,-25,-0.2)))
Error in maxRoutine(fn = logLik, grad = grad, hess = hess, start = start, :
NA in the initial gradient
> p = summary(maxLik(fr,start=c(0,0,0,1,0,-25,-0.2),method="BFGS"))
Error in optim(start, func, gr =
2010 Sep 07
5
question on "optim"
Hey, R users
I do not know how to describe my question. I am a new user for R and write the
following?code for a dynamic labor economics?model and use OPTIM to get
optimizations and parameter values. the following code does not work due to
the?equation:
?? wden[,i]<-dnorm((1-regw[,i])/w[5])/w[5]
where w[5]?is one of the parameters (together with vector a, b and other
elements in vector
2009 Mar 08
2
survreg help in R
Hey all,
I am trying to use the survreg function in R to estimate the mean and
standard deviation to come up with the MLE of alpha and lambda for the
weibull distribution. I am doing the following:
times<-c(10,13,18,19,23,30,36,38,54,56,59,75,93,97,104,107,107,107)
censor<-c(1,0,0,1,0,1,1,0,0,0,1,1,1,1,0,1,0,0)
survreg(Surv(times,censor),dist='weibull')
and I get the following
2010 Nov 15
1
interpretation of coefficients in survreg AND obtaining the hazard function
1. The weibull is the only distribution that can be written in both a
proportional hazazrds for and an accelerated failure time form. Survreg
uses the latter.
In an ACF model, we model the time to failure. Positive coefficients
are good (longer time to death).
In a PH model, we model the death rate. Positive coefficients are
bad (higher death rate).
You are not the first to be confused
2007 Nov 29
1
Survreg(), Surv() and interval-censored data
Can anybody give me a neat example of interval censored data analysis codes in R?
Given that suvreg(Surv(c(1,1,NA,3),c(2,NA,2,3),type="interval2")~1)
works why does
survreg(Surv(data[,1],data[,2],type="interval2")~1)
not work where
data is :
T.1 T.2 Status
1 0.0000000 0.62873036 1
2 0.0000000 2.07039068 1
3 0.0000000
2008 Apr 17
1
survreg() with frailty
Dear R-users,
I have noticed small discrepencies in the reported estimate of the
variance of the frailty by the print method for survreg() and the
'theta' component included in the object fit:
# Examples in R-2.6.2 for Windows
library(survival) # version 2.34-1 (2008-03-31)
# discrepancy
fit1 <- survreg(Surv(time, status) ~ rx + frailty(litter), rats)
fit1
fit1$history[[1]]$theta
2012 Nov 15
2
survreg & gompertz
Hi all,
Sorry if this has been answered already, but I couldn't find it in the
archives or general internet.
Is it possible to implement the gompertz distribution as
survreg.distribution to use with survreg of the survival library?
I haven't found anything and recent attempts from my side weren't
succefull so far.
I know that other packages like 'eha' and
2005 Nov 18
1
Truncated observations in survreg
Dear R-list
I have been trying to make survreg fit a normal regression model with left
truncated data, but unfortunately I am not able to figure out how to do it.
The following survreg-call seems to work just fine when the observations are
right censored:
library(survival)
n<-100000
#censored observations
x<-rnorm(n)
y<-rnorm(n,mean=x)
d<-data.frame(x,y)
d$ym<-pmin(y,0.5)