[R] clogit & weights

2015-12-21 Thread knouri via R-help
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]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] Cross-over Data with Kenward-Roger correction

2015-06-07 Thread knouri
Dear all:for the folowing data, a two-period, two treatment (A=1 vs. B=2) 
cross-over is fitted
using the folowing SAS code.  
data one;
input  Sbj  Seq  Per  Trt  PEF;
cards;
1  1   1   1   310
1  1   2   2   270
4  1   1   1   310
4  1   2   2   260
6  1   1   1   370
6  1   2   2   300
7  1   1   1   410
7  1   2   2   390
10    1   1   1   250
10    1   2   2   210
11    1   1   1   380
11    1   2   2   350
14    1   1   1   330
14    1   2   2   365
2  2   1   2   370
2  2   2   1   385
3  2   1   2   310
3  2   2   1   400
5  2   1   2   380
5  2   2   1   410
9  2   1   2   290
9  2   2   1   320
12    2   1   2   260
12    2   2   1   340
13    2   1   2    90
13    2   2   1   220
;
run;
proc mixed data=one method=reml;
class Sbj Per Trt;
   model PEF = Per Trt /ddfm=kr;
   repeated Trt / sub=Sbj type=un r;
   lsmeans Trt / cl alpha=0.05;
   estimate 'B vs. A' Trt -1  1 / alpha=0.1 cl;
run;
(where kr option is for Kenward-Roger method).I need to use R to reproduce the 
results similar to what the above SAS code generates.
I have used several R functions including lme, lmer with no success so far.Any 
advice will be greatly appreciated,Sincerely,
Keramat

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] Bivariate skew normal cdf; very slow

2013-08-26 Thread knouri
Dear all,
I am calculating the bivariate skew normal cdf in sn package using pmsn 
function.
Although it is quite convenient ( thanks to prof. Azzalini) but it seems to be 
slow.
For example, it takes about 1 minute in calculation of 100k of such cdf values.
I am thinking to write a c++ code for this although not very familiar with it.
Any other idea?  
 Thanks in advance,
sincerely,


Keramat Nourijelyani, PhD
Associate Professorof Biostatistics
Tehran University of Medical Sciences
http://tums.ac.ir/faculties/nourij

[[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] MCMC with cumulative link models

2013-07-30 Thread knouri
Hi:
Could anyone please let me know where I can find [R] code for implementing 
MCMC with cumulative link models (i.e. for analysis of ordinal probit or 
ordinal logistic models).
 
Thanks in advance,
Regards,



Keramat Nourijelyani, PhD
Associate Professorof Biostatistics
Tehran University of Medical Sciences
http://tums.ac.ir/faculties/nourij

[[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] MLE for probit regression. How to avoid p=1 or p=0

2013-05-27 Thread knouri


Dear all: 

I am writing the following small function for a probit likelihood.
As indicated, in order to avoid p=1 or p=0, I defined some precisions.
I feel however, that there might be a better way to do this.
Any help is greatly appreciated.

##

##set limits to avoid px=0 or px=1
precision1   - 0.99
precision0   - 0.01

logpost - function(par, data){
px    - pnorm(b0 + b1x)
# to avoid px=1 or px=0
px[px   precision1] - precision1
px[px   precision0] - precision0
loga  - sum( y*log(px)+(1-y)*log(1-px) )
loga
}

#



Best,
 


Keramat Nourijelyani, PhD
Associate Professorof Biostatistics
Tehran University of Medical Sciences
http://tums.ac.ir/faculties/nourij

[[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] Bayesian Haplotype analysisin R

2012-12-11 Thread knouri
Dear members:
Could you please tell me the package for Bayesian haplotype estimation  in R.
Currently PHASE is available for such purpose but I need a similar R package.

Best regards,



Keramat Nourijelyani, PhD
Associate Professorof Biostatistics
Tehran University of Medical Sciences
http://tums.ac.ir/faculties/nourij

[[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] problem with the MLE of the skew-normal shape parameter

2012-03-29 Thread knouri
Hi everyone:
my likelihood function involves the shape parameter of the skew-normal in 
addition to other parameters.
I used both optim and nlm function to find the MLS's.
However, every time that I use a different initial value for the shape 
parameter, I get a different
estimate for it. No such problem with other parameters when I exclude the 
skew-normal shape parameter.
Any advice in this regards will be greatly appreciated.
 
Best,


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