[R] R-help Digest, Vol 31, Issue 9

Wuming Gong wuming.gong at gmail.com
Sun Sep 11 04:06:17 CEST 2005


Hi Ping, 

You can use zz$coefficients[,4] to get the p values for each estimated
coefficients in your context.

Wuming 

On 9/11/05, Ping Yao <sdshlxh at gmail.com> wrote:
> Wuming:
>             Thanks for your help.
>            I use the fuction:
>    call("fstatistic",zz)
>   call("p-value",zz)
>  
>  I can get each variable P-values,but I can't  get P-value of the model.
>  How can I do ?
>           
>        one of the results is following :
>  
>  Call:
>  lm(formula = gen.fat ~ snp_marker)
>  
>  Residuals:
>       Min       1Q   Median       3Q      Max 
>  -10.5455  -3.0481   0.4545   3.9519   6.9519 
>  
>  Coefficients:
>                    Estimate Std. Error t value Pr(>|t|)    
>  (Intercept)        13.0481     0.4518  28.881   <2e-16 ***
>  snp_markerallele2   0.5107     0.9102   0.561   0.5753    
>  snp_markerBoth      1.4974     0.6927   2.162   0.0318 *  
>  ---
>  Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 
>  
>  Residual standard error: 4.607 on 212 degrees of freedom
>  Multiple R-Squared: 0.02166,    Adjusted R-squared: 0.01244 
>  F-statistic: 2.347 on 2 and 212 DF,  p-value: 0.0981 
>  
>  I use the code :
>  
>  zz<-summary(lm.D9 <- lm(gen.fat~snp_marker))
>    coe<-coef(lm.D9)# the bare coefficients
>  if (coe[2]<=.05||coe[3]<=.05||coe[4]<=.05||coe[5]<=.05) {
>  cat("phenotype is  = ",x[j] , "\n")
>  cat("snp marker is  = ",x[i] , "\n")
>     sign<-call("fstatistic",zz)
>   call("p-value",zz)
>     
>    #print(coe)
>    print(zz)
> 
>  }
>  
>  
>  
>  
>  
> 
> On 9/10/05, Wuming Gong <wuming.gong at gmail.com> wrote:
> > ?summary.lm and check the Value section.
> > 
> > Wuming
> > 
> > On 9/10/05, Ping Yao <sdshlxh at gmail.com> wrote:
> > > Hi:
> > > I use lm (linear model) to analyze 47 variables , 8 responses 
> > > So I use loop to finish it .
> > > I want the program to show the results that P-value is less than 0.05.
> > > How can I cite the P-valus from lm result ?
> > >
> > > Ping
> > >
> > > The code:
> > > 
> > >
> > > #using LM to model general fati
> > > for (j in 48:52) {
> > > for (i in 3:46){
> > > gen.fat<-y_x[,j]
> > > gen.fat<-as.numeric(gen.fat)
> > >
> > > snp_marker<-y_x[,i]
> > >
> > > x<-colnames(y_x) 
> > >
> > > #snp_marker<-as.matrix(snp_marker)
> > > #mode(snp_marker)
> > > cat("phenotype is = ",x[j] , "\n")
> > > cat("snp marker is = ",x[i] , "\n")
> > >
> > > zz<-summary( lm.D9 <- lm(gen.fat~snp_marker))
> > >
> > > print(zz)
> > >
> > > return
> > > }
> > > }
> > >
> > >         [[alternative HTML version deleted]]
> > >
> > > ______________________________________________ 
> > > 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