> Dear All > > I have data as follows. > > D T M L > 0.20 1 03 141 > 0.32 1 07 62 > 0.50 1 05 49 > 0.80 1 04 46 > 0.20 2 14 130 > 0.32 2 17 52 > 0.50 2 13 41 > 0.80 2 14 36 > 0.20 3 24 120 > 0.32 3 28 41 > 0.50 3 24 30 > 0.80 3 22 28 > 0.20 4 31 113 > 0.32 4 44 25 > 0.50 4 39 15 > 0.80 4 36 14 > 0.20 5 35 109 > 0.32 5 47 22 > 0.50 5 43 11 > 0.80 5 44 06 > 0.20 6 38 106 > 0.32 6 49 20 > 0.50 6 45 09 > 0.80 6 46 04 > > I want to fit a negative binomial regression model where "M" is the > required success and "L" is number of units to have the required > success. > > I want to fit the following model > > GLM link, log(1-M / (M+L)) = constant + theta 1 * log(D) + theta 2 * > 1/T + theta 3 * log(D) * 1 / T > > I wrote the function as > > dat = read.table("N_d_t_F.txt",header=T) > > N_D = 4 > N_T = 6 > > dat$x = log(dat$D) > dat$p = dat$M / (dat$L+dat$M) > dat$InvT = 1/dat$T > dat$glm1= log(1-dat$p) > > negloglike = function(parms, dat){ > > pp = design%*%parms > p = 1-exp(pp) > > obj = 0 > t_D = 0 > for(d in 1:N_D){ > for(t in 1:N_T){ > t_D = t_D+1 > > obj = obj + dat$M[t_D]*log(p[t_D]) > obj = obj + dat$L[t_D]*log(1-p[t_D]) > > } > } > -obj > } > > design = cbind(1, dat$x, dat$InvT, dat$x*dat$InvT) > g = lm(glm1~design-1, dat, subset=c(p>0)) > mle.fit = optim(coef(g), negloglike, > dat=dat, hessian=T) > > However, this function does not optimize properly. It always creates > some errors. > > How can I optimize this model? > > This is not a count data. That's why I can not use the function > "glm.nb" or "aod" package. > > Would you please give me some suggestions so that I can optimize the > function? >[[alternative HTML version deleted]]
> > Dear Madam, Sir, > Dear Madam, Sir, > I am a student in statistics at the Universit? Rennes 1 (France), I've used > the polr function in R to estimate an ordered probit model (consumer > preference) but the strange thing is that *I did not get the probabilities > which can tell me whether the variables are significant or not*. My model > has a dep var with 6 levels (0 to 5) and 19 explanatory variables (both > dummy and continues). Below is the code that I used and the result that I > got. Also I enclosed a part of the data used in the model for further help. > I am waiting for your help to fix this issue, many thanks. > *******Code**** > m <- sqlQuery(channel = 1, select * from [Feuil2$]) > m$Depvar <- as.factor(m$Depvar) > library(MASS, pos=4) > prm <- polr(Depvar ~ var1 + var2 + var3 + var4 + var5 +var6 + var7 + var8 + > > var9, method="probit", data=m, Hess=TRUE) > summary(prm) > > *****Output***** > > m <- sqlQuery(channel = 1, select * from [Feuil2$]) > > m$Depvar <- as.factor(m$Depvar) > > library(MASS, pos=4) > > prm <- polr(Depvar ~ var1 + var2 + var3 + var4 + var5 +var6 + var7 + var8 > + > + var9, method="probit", data=m, Hess=TRUE) > > summary(prm) > Call: > polr(formula = Depvar ~ var1 + var2 + var3 + var4 + var5 + var6 + > var7 + var8 + var9, data = m, Hess = TRUE, method = "probit") > Coefficients: > Value Std. Error t value *how to get P-values > ? > *var1 0.04454384 0.10390217 0.4287094 *? > *var2 0.22172411 0.10221326 2.1692305 *?* > var3 -0.19858516 0.09909994 -2.0038879 *?* > var4 0.48806601 0.10375119 4.7041967 *?* > var5 0.01845784 0.10018124 0.1842444 *?* > var6 -0.37819633 0.10170134 -3.7186955 *?* > var7 0.06047232 0.03234284 1.8697284 *?* > var8 0.39855835 0.19211257 2.0746084 *?* > var9 0.16119371 0.04692679 3.4350044 *?* > Intercepts: > Value Std. Error t value > 0|1 -0.2063 0.2931 -0.7040 > 1|2 0.3162 0.2903 1.0889 > 2|3 0.7557 0.2900 2.6059 > 3|4 1.2209 0.2913 4.1915 > 4|5 1.7293 0.2944 5.8736 > Residual Deviance: 1667.097 > AIC: 1695.097 > Thank you for your time > sincerely > Thierno, Universit? de Rennes 1 France >
We get an error while using the following function.Please advise. newton.method(FUN = function(b) 10/b+sum(a)-10*sum((x^b)*a)/sum(x^b), init = 5, tol = 0.001) Error in deriv.default(as.expression(body(FUN)), nms, function.arg = TRUE) : Function 'sum' is not in the derivatives table -- Kanchan Jain Professor Deptt. of Statistics Panjab University Chandigarh-160014 (India) +919872641634 +919814301634 RES: House No. 34, Sector 16, Panchkula -134113 (India) Ph: 0172-2572505, 0172-2567781 [[alternative HTML version deleted]]
No no... This is not in R code. I mean that when in the R, I use arules library, and try to create a association rules for this transaction file: a,c,f,3,4,5 b,e,1,2,4 a,c,e,f,1,3,4,5 d,5 b,c,e,f,1,2,3,4 a,c,e,f,1,3,4,5 b,c,e,f,1,3,4 b,e,1,2,4 a,c,e,f,1,3,4,5 a,b,c,e,f,1,3,4 a,c,d,f,3,4,5 I want to get the rule such: {c,e,f}=> {3,4,5} I used this command: ar=apriori(tr, parameter=list(support=.4, confidence=0.8, maxlen=11), appearance =list(lhs=c("a","b","c","d","e","f"),rhs=c("1","2","3","4","5"))) and I just get the rule such: {c,e,f} => {3} {c,e,f} => {4} and the number of items appear in the right hand side of the rules is always 1. but I want to see more than 1 item in the right hand side of the rules such left hand size.in the left hand side I can see 1, 2 or 5 item but in the rhs just one. I need to have more than 1 item in rhs. thanks a lot Nooshin Quoting "Kevin E. Thorpe" <kevin.thorpe at utoronto.ca>:> Four things. > > First, I think you meant to send this to r-help at r-project.org. > > Second, I'm not even sure what you are asking. The "examples" you give > are not even valid R code. Are you sure this is an R question? If so, > make your question clearer. > > Third, please use a more informative subject than "help." > > Fourth. please read the posting guide > > http://www.r-project.org/posting-guide.html > > omranian at uni-potsdam.de wrote: >> Hello, >> >> How can I change the number of items appear in right hand side of a >> rule? I always get >> just one item in rhs >> a,b,c=>1 >> but I want to see the rules such: >> a,b,c=>1,2,3,4 >> please help me!!! >> >> tnx >> >> > > > -- > Kevin E. Thorpe > Biostatistician/Trialist, Knowledge Translation Program > Assistant Professor, Dalla Lana School of Public Health > University of Toronto > email: kevin.thorpe at utoronto.ca Tel: 416.864.5776 Fax: 416.864.3016
I want to unsuscribe from the R list. Thanks.
Christine SINOQUET wrote:> I want to unsuscribe from the R list.then visit this website: https://stat.ethz.ch/mailman/listinfo/r-help Best, Dimitris> Thanks. > > ______________________________________________ > 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. >-- Dimitris Rizopoulos Assistant Professor Department of Biostatistics Erasmus University Medical Center Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands Tel: +31/(0)10/7043478 Fax: +31/(0)10/7043014
While loading files i am getting this type of error mentioned below. Error in file(file, "rt") : cannot open the connection In addition: Warning message: In file(file, "rt") : cannot open file 'D:/samplelist': No such file or directory could you please help me to resolve this problem. [[alternative HTML version deleted]]