lm_mengxin,

Yes, it happens because you are not following what Dr. Chongsuvivatwong
suggested you in a previous email.  Compare

> yourdata$age1 <- factor(yourdata$gender)
> result1<-glm(y ~ gender + CD4,family = binomial, data=yourdata)
> logistic.display(result1)

and

> fit <-glm(y ~ as.factor(gender), family = binomial, data=yourdata)
> logistic.display(fit)

with what you sent.

And, please, include an appropriate subject line next time as requested in
the Posting Guide.

HTH,
Jorge.-


2011/12/14 ©sªY <>

> Sir:
> I find out that for 2 level factor, if I set it to "factor", then I'll get
> error reply.
> For the instance last mail, if I use:
>
> result1<-glm(y ~ gender,family = binomial);#gender has 2 levels
> logistic.display(result1)
>
> Error in coeff[, 1] : incorrect number of dimensions
>
>
>  if I use:
>
> result1<-glm(y ~ factor(age),family = binomial); #age has 3 levels
> logistic.display(result1)
>
> It works well.
>
> So I have a suggestion that no matter the number of levels, if I set it to
> factor, logistic.disply can all works well.
>
>
>
>
>
> logistic.display
>
>
> At 2011-12-14 13:53:21,"Virasakdi Chongsuvivatwong" <> wrote:
>
> logistic.display need a rather tidy model ie all independent variables
> must be the original name not any function of a variable in the dataset of
> the model.
>
> If data1 is your dataset containing y, 'gender' and 'age', what you need
> to do is
>
> > data1$age1 <- factor(data1$age)
> > result1<-glm(y ~ age1 + gender + CD4,family = binomial, data=data1)
> > logistic.display(result1)
>
> Note that 'gender', like 'y', is already dichotomized (0,1). There is no
> need to 'factor'
>
> Virasakdi C
>
>
> 2011/12/14 ©sªY <>
>
>>
>> Hi sir:
>> I follow your suggestion:
>>
>> result<-glm(y ~ factor(age) + factor(gender) + CD4,family = binomial)
>> logistic.display(result)
>>
>> Error in coeff[, 1] : incorrect number of dimensions
>>
>>
>>
>>
>>
>>
>> At 2011-12-14 01:59:36,"Jorge I Velez" <> wrote:
>>
>> Hi there,
>>
>> Try
>>
>> require(epicalc)
>> logistic.display(result)
>>
>> HTH,
>> Jorge
>>
>> On Tue, Dec 13, 2011 at 7:16 AM, ©sªY <> wrote:
>>
>>> Hi all:
>>> My data has 3 variables:
>>> age(3levels : <30y=1  30-50y=2, >50y=3)
>>> gender(Male=0, Female=1)
>>> CD4 cell count(raw lab measurement)
>>> y(1:death  0:alive)
>>>
>>> I perform logistic regression to find out the factors that influence y.
>>>
>>> result<-glm(y ~ factor(age) + factor(gender) + CD4,family = binomial)
>>>
>>> >From the result,I can get OR(Odds Ratio) of gender  via exp(Estimate of
>>> Female, since Male is regarded as reference group and has no result).But
>>> how can I compute the 95%CI of OR of gender?
>>>
>>>
>>> Thanks a lot for your help.
>>>
>>> My best!
>>>
>>>
>>>
>>>
>>>        [[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.
>>>
>>
>>
>>
>>
>> --
>>
>> -- NOTE: Prince of Songkla University will NEVER ask for your PSU
>> Passport/Email Username or password by e-mail. If you receive such a
>> message, please report it to report-ph...@psu.ac.th.
>> ------------------------------
>> !!!! NEVER reply to any e-mail asking for your PSU Passport/Email or
>> other personal details. !!!!
>> ------------------------------
>> For more information, contact the PSU E-Mail Service by dialing 2121
>>
>>
>>
>
>
>

        [[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.

Reply via email to