[R] an issue about missing data

David Winsemius dwinsemius at comcast.net
Thu Aug 5 22:40:36 CEST 2010


On Aug 5, 2010, at 3:59 PM, karena wrote:

>
> library(GenABEL)
> gs.b <- gs

 > library(GenABEL)
Loading required package: MASS
GenABEL v. 1.6-0 (June 21, 2010) loaded
 > gs.b <- gs
Error: object 'gs' not found

You are not making this easy. I asked what str(gs) returned. Instead  
you gave us code but no data or even information about the data. There  
was always a chance that gs was part of that package, so I installed  
GenABEL and its 5 dependencies. The mind-reading abilities of most  
listeRs, and especially mine, are fairly limited.


> ok <- complete.cases(gs.b at phdata[,c('sex','age','b.dbp','b.bmi')])
> gs.b <- gs.b[ok]

So what does str(gs.b) now look like?

> gs.b at phdata <- gs.b at phdata[,c('id','sex','age','b.dbp','b.bmi')]
> index=1:gs.b at gtdata@nsnps
> ran.snp=sample(index,261,replace=F)
> gs.b.gkin=ibs(gs.b[,ran.snp], weight="freq")

We might also need to see what str(gs.b.gkin) returned.

>
> attach(gs.b at phdata)
> age2 <- age^2
> age3 <- age^3

I am not knowledgeable about GenABEL, but other regression programs  
have functions for correctly generating polynomial terms.

> ##lm.bmi <- lm(bmi~age+age2+age3+sex)
> ##step.bmi <- step(lm.bmi)
> ##bmi.adj <- residuals(step.bmi)
>
> h2.gs.b <- polygenic(b.dbp~age+age2+age3+sex+b.bmi, kin=gs.b.gkin,
> data=gs.b)

I'm not sure if there was an assignment and creation of age2 and age3  
inside gs.b. It might work, but there are weird gotcha's with attached  
objects. I avoid it completely.

-- 
David.
>
>
> ######
> Hi, david, above is my code. So I first removed the 3 individuals  
> who have
> some missing data, then I performed the polygenic function with the  
> complete
> data.
>
> thanks,
>
> karena
> -- 
> View this message in context: http://r.789695.n4.nabble.com/an-issue-about-missing-data-tp2315094p2315536.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list