Re: [R] glmnet for Binary trait analysis

2011-09-21 Thread Noah
Hi Bert,

You are correct. I checked the data and did find some empty values in the X
matrix. 

Thanks for your kindly help!

Noah

--
View this message in context: 
http://r.789695.n4.nabble.com/glmnet-for-Binary-trait-analysis-tp3828547p3830581.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] glmnet for Binary trait analysis

2011-09-21 Thread Bert Gunter
... another possibiity, probably more likely since you read your files in
from disk, is that there is a stray character of some sort (e.g. extra
comma, quotation mark, period) in your data that is causing what should be
numeric data to be read in as character. Check your data after you've read
them in.

-- Bert

On Wed, Sep 21, 2011 at 6:46 AM, Bert Gunter  wrote:

> The man page tells you that y must be a factor. Is it?
> -- Bert
>
> On Tue, Sep 20, 2011 at 5:25 PM, Noah  wrote:
>
>> Hello,
>>
>> I got an error message saying
>>
>> Error in lognet(x, is.sparse, ix, jx, y, weights, offset, alpha, nobs,  :
>>  NA/NaN/Inf in foreign function call (arg 5)
>>
>> when I try to analysis a binary trait using glmnet(R) by running the
>> following code
>>
>> library(glmnet)
>> Xori <- read.table("c:\\SNP.txt", sep='\t');
>> Yori <- read.table("c:\\Trait.txt", sep=',');
>> Y=as.matrix(Yori);
>> X=t(as.matrix(Xori));
>> fit1=glmnet(X, Y, family="binomial");
>>
>> in the above, X is a matrix with values 1, 0, and -1; Y is a one column
>> matrix with values 1 and 0.
>>
>> I know how to analysis continuous traits using glmnet, but I have no idea
>> about how to do it for binary dependent variables. I will appreciate it if
>> you would give me any suggestion about this error or provide an example
>> code
>> for handling binary trait using glmnet.
>>
>> Looking forward for your kindly help.
>>
>> Thanks!
>>
>> Noah
>>
>> --
>> View this message in context:
>> http://r.789695.n4.nabble.com/glmnet-for-Binary-trait-analysis-tp3828547p3828547.html
>> Sent from the R help mailing list archive at Nabble.com.
>>
>> __
>> R-help@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.
>>
>
>
>
> --
> "Men by nature long to get on to the ultimate truths, and will often be
> impatient with elementary studies or fight shy of them. If it were possible
> to reach the ultimate truths without the elementary studies usually prefixed
> to them, these would not be preparatory studies but superfluous diversions."
>
> -- Maimonides (1135-1204)
>
> Bert Gunter
> Genentech Nonclinical Biostatistics
>
>
>
>


-- 
"Men by nature long to get on to the ultimate truths, and will often be
impatient with elementary studies or fight shy of them. If it were possible
to reach the ultimate truths without the elementary studies usually prefixed
to them, these would not be preparatory studies but superfluous diversions."

-- Maimonides (1135-1204)

Bert Gunter
Genentech Nonclinical Biostatistics

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] glmnet for Binary trait analysis

2011-09-21 Thread Bert Gunter
The man page tells you that y must be a factor. Is it?
-- Bert

On Tue, Sep 20, 2011 at 5:25 PM, Noah  wrote:

> Hello,
>
> I got an error message saying
>
> Error in lognet(x, is.sparse, ix, jx, y, weights, offset, alpha, nobs,  :
>  NA/NaN/Inf in foreign function call (arg 5)
>
> when I try to analysis a binary trait using glmnet(R) by running the
> following code
>
> library(glmnet)
> Xori <- read.table("c:\\SNP.txt", sep='\t');
> Yori <- read.table("c:\\Trait.txt", sep=',');
> Y=as.matrix(Yori);
> X=t(as.matrix(Xori));
> fit1=glmnet(X, Y, family="binomial");
>
> in the above, X is a matrix with values 1, 0, and -1; Y is a one column
> matrix with values 1 and 0.
>
> I know how to analysis continuous traits using glmnet, but I have no idea
> about how to do it for binary dependent variables. I will appreciate it if
> you would give me any suggestion about this error or provide an example
> code
> for handling binary trait using glmnet.
>
> Looking forward for your kindly help.
>
> Thanks!
>
> Noah
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/glmnet-for-Binary-trait-analysis-tp3828547p3828547.html
> Sent from the R help mailing list archive at Nabble.com.
>
> __
> R-help@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.
>



-- 
"Men by nature long to get on to the ultimate truths, and will often be
impatient with elementary studies or fight shy of them. If it were possible
to reach the ultimate truths without the elementary studies usually prefixed
to them, these would not be preparatory studies but superfluous diversions."

-- Maimonides (1135-1204)

Bert Gunter
Genentech Nonclinical Biostatistics

[[alternative HTML version deleted]]

__
R-help@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.


[R] glmnet for Binary trait analysis

2011-09-20 Thread Noah
Hello, 

I got an error message saying 

Error in lognet(x, is.sparse, ix, jx, y, weights, offset, alpha, nobs,  : 
  NA/NaN/Inf in foreign function call (arg 5)

when I try to analysis a binary trait using glmnet(R) by running the
following code

library(glmnet)
Xori <- read.table("c:\\SNP.txt", sep='\t');
Yori <- read.table("c:\\Trait.txt", sep=',');
Y=as.matrix(Yori);
X=t(as.matrix(Xori));
fit1=glmnet(X, Y, family="binomial");

in the above, X is a matrix with values 1, 0, and -1; Y is a one column
matrix with values 1 and 0.

I know how to analysis continuous traits using glmnet, but I have no idea
about how to do it for binary dependent variables. I will appreciate it if
you would give me any suggestion about this error or provide an example code
for handling binary trait using glmnet. 

Looking forward for your kindly help.

Thanks!

Noah

--
View this message in context: 
http://r.789695.n4.nabble.com/glmnet-for-Binary-trait-analysis-tp3828547p3828547.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.