Displaying 6 results from an estimated 6 matches for "testfit".
2008 Nov 06
1
Strang line while plotting failure curves
...encountered a problem when I tried to plot the cumulative failure rate
(i.e. 1 - survival probability). I have used the following code to plot. The
scenario is that patients are randomized to different treatment arm (rev in
the code), the PCI revascularization was monitored over 5 years.
#R code
testfit <- survfit(Surv(pcifu,pci)~rev,data=subproc)
testfit$surv <- 1 - testfit$surv
testfail <- plot(testfit, mark.time=FALSE,col=1:2, main='Failure Rate')
#End of R code
I arbitarily replaced testfit$surv by computing 1 minus the original
survival rate. So far so good. However, when...
2006 Jan 08
1
confint/nls
...ot;default","plinear","port")))
resmat.fix <- resmat
## sim. values
npts=1000
set.seed(1001)
x = runif(npts)
b = 0.7
y = x^b+rnorm(npts,sd=0.05)
a =0.5
y2 = a*x^b+rnorm(npts,sd=0.05)
c = 1.0
y3 = a*(x+c)^b+rnorm(npts,sd=0.05)
d = 0.5
y4 = a*(x^d+c)^b+rnorm(npts,sd=0.05)
testfit <- function(model,start,alg) {
tryfit <- try(fit <-
nls(model,start=start,algorithm=alg,control=list(maxiter=200)))
if (class(tryfit)!="try-error") {
fitcode="OK"
tryci <- try(confint(fit))
if (class(tryci)!="try-error") {
cicod...
2009 Jul 15
0
time series fiting and residual computing
...monic function as:
#m(t)=a+bt+ct^2+c1sin(omega1*t)+d1cos(omega1.t)+c2sin(omega2.t)+d2cos(omega2.t)+c3sin(omega3.t)+d3cos(omega3.t)+c4sin(omega4.t)+d4cos(omega4.t)
# In my data 'file' I have two variable 'co2obs' and 'time'
# SO above function in R will look like EITHER as:
testfit<-lm(co2obs~1+time+(time^2)+sin(2*pi*time)+cos(2*pi*time)+sin(4*pi*time)+cos(4*pi*time)+sin(6*pi*time)+cos(6*pi*time)+sin(8*pi*time)+cos(8*pi*time),data=file)
#RESIDUALS COMPUTING for above data fit
testfit$residuals
OR as:
testfit<-lm(co2obs~1+time+I(time^2)+sin(2*pi*time)+cos(2*pi*time)+si...
2008 Sep 30
0
Root-Mean-Square(RMS) Difference
...mulation, during
1993-2002).
In order to do it I am calculating Root-Mean-Square(RMS) difference
with following formula:
> sqrt(sum((observed_residual - simulated_residual)^2)/n) # 'n' is number of
observations
Residuals are computed by fitting a harmonic function on both the data:
>testfit<-lm(co2obs~1+time+I(time^2)+sin(2*pi*time)+cos(2*pi*time)+sin(4*pi*time)+cos(4*pi*time)+sin(6*pi*time)+cos(6*pi*time)+sin(8*pi*time)+cos(8*pi*time),data=file)
#
>testfit1<-lm(co2model~1+time+I(time^2)+sin(2*pi*time)+cos(2*pi*time)+sin(4*pi*time)+cos(4*pi*time)+sin(6*pi*time)+cos(6*pi*time...
2013 Jan 12
4
nesting in CoxPH with survival package
Hello all,
I am trying to understand how to specify nested factors when using
coxph(), and if it is appropriate to nest these factors in my
situation.
In the simplest form, I am testing two different temperatures, with
each temperature being performed twice in different experimental
periods (e.g. Temp5 performed in Period A and C, Temp4 performed in
Period B and D)
I am trying to see if survival
2013 Jan 17
3
coxph with smooth survival
Hello users,
I would like to obtain a survival curve from a Cox model that is smooth and does not have zero differences due to no events for those particular days.
I have:
> sum((diff(surv))==0)
[1] 18
So you can see 18 days where the survival curve did not drop due to no events.
Is there a way to ask survfit to fit a nice spline for the survival??
Note: I tried survreg and it did not