[R] help: how to get coefficients from the result

McGehee, Robert Robert.McGehee at geodecapital.com
Fri Feb 25 01:15:35 CET 2005


?coef should do the trick.

-----Original Message-----
From: mingan [mailto:mingan at math.unm.edu] 
Sent: Thursday, February 24, 2005 5:12 PM
To: r-help at stat.math.ethz.ch
Subject: [R] help: how to get coefficients from the result



 I am using timereg and Survreg packages



 below is the output, but how can I get the coefficient for zt1 zt2 
directly,
that is how can I get 0.000946 and 0.963000 directly ?

  I tried  out$coeff[1,1] or sth. similar, but does not work


since I will run a simulation of several thousand, so I should get the 
coefficients directly

 thanks

 



 >  out=prop.odds(Surv(t,d)~zt1+zt2)
Proportional odds model
 > summary(out)
Proportional Odds model

Test for baseline
Test for non-siginificant effects
         sup| hat B(t)/SD(t) | p-value H_0: B(t)=0
Baseline                  11.9                   0
Test for time invariant effects
         sup| B(t) - (t/tau)B(tau)| p-value H_0: B(t)=b t
Baseline                        358                 0.342

Covariate effects
       Coef. Std. Error Robust SE D2log(L)^-1
zt1 0.000946     0.0890    0.0885      0.0891
zt2 0.963000     0.0574    0.0584      0.0541
  
Score Tests for Goodness-of-fit
    sup| hat U(t) | p-value H_0
zt1            6.73        0.848
zt2           12.20        0.798

  
  Call:
prop.odds(Surv(t, d) ~ zt1 + zt2)



















n=50; iter=1000
beta1=0;beta2=1

zt1=NULL
zt2=NULL
t=NULL
for( i in 1:n)
{
    z1=rbinom(1,1,0.5)
    z2=rexp(1,1)
    zt1=c(zt1,z1)
    zt2=c(zt2,z2)
    u=runif(1,0,1)
    temp=exp(-z1*beta1-z2*beta2)*u/(1-u)
    t=c(t,temp)
}

   d=rep(1,n)

 mt=cbind(t,d,zt1,zt2)

 out=prop.odds(Surv(t,d)~zt1+zt2)
summary(out)

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html




More information about the R-help mailing list