[R] clogit and weights

Therneau, Terry M., Ph.D. therneau at mayo.edu
Tue Dec 22 14:21:26 CET 2015


How should the weights be treated?  If they are multiple observation weights (a weight of 
"3" is shorthand for 3 subjects) that leads to a different likelihood than sampling 
weights ("3" means to give this one subject more influence).  The clogit command can't 
read your mind and so has chosen not to make a guess.

Also, please do not post in html.  As you see below it leads to a mangled message.

Terry Therneau


On 12/22/2015 05:00 AM, r-help-request at r-project.org wrote:
> Merry Christmas everyone:
> I have the following data(mydat) and would like to fit a conditional logistic regression model considering "weights".
> id? case?exposure?? weights
> 1?????1?????????1????????? 2
> 1?????0?????????0????????? 2
> 2?????1?????????1????????? 2
> 2?????0?????????0????????? 2
> 3?????1?????????1????????? 1
> 3?????0?????????0????????? 1
> 4?????1?????????0???????? ?2
> 4?????0?????????1????????? 2 ?The R function"clogit" is for such purposes but it ignores weights.?I tried function"mclogit" instead which seems that it considers the weights option:##############################################################options(scipen=999)library(mclogit)# create the above data frameid????????? = c(1,1,2,2,3,3,4,4)case????? =?c(1,0,1,0,1,0,1,0)exposure = c(1,0,1,0,1,0,0,1)weights? = c(2,2,2,2,1,1,2,2)(mydata??= data.frame(id,case,exposure,weights)) fit??????= mclogit(cbind(case,id) ~ exposure,weights=weights, data=mydata)summary(fit)######################################################################
> The answer,however,?doesn't seem to be?correct. Could anyone?pleaseprovides me with some solution to this??Thanks in advance,Keramat Nourijelyani,PhD??
>
> 	[[alternative HTML version deleted]]
>



More information about the R-help mailing list