Re: [R] Likelihood ratio test in porl (MASS)

2016-07-27 Thread Faradj Koliev
Dear Achim Zeileis, dear John Fox, Thank you for your time! Both worked well. lrtest(Restrict, Full) #Df LogLik Df Chisq Pr(>Chisq) 1 27 -882.00 2 28 -866.39 1 31.212 2.313e-08 *** anova(Restrict, Full) Resid. df Resid. Dev TestDf LR stat. Pr

Re: [R] Likelihood ratio test in porl (MASS)

2016-07-27 Thread Fox, John
Dear Faradj Koliev, There is an anova() method for "polr" objects that computes LR chisquare tests for nested models, so a short answer to your question is anova(Full, Restricted). The question, however, seems to reflect some misunderstandings. First aov() fits linear analysis-of-variance mode

Re: [R] Likelihood ratio test in porl (MASS)

2016-07-27 Thread Achim Zeileis
On Wed, 27 Jul 2016, Faradj Koliev wrote: Dear all, A quick question: Let?s say I have a full and a restricted model that looks something like this: Full<- polr(Y ~ X1+X2+X3+X4, data=data, Hess = TRUE, method="logistic?) # ordered logistic regression Restricted<- polr(Y ~ X1+X2+X3, data=da

Re: [R] likelihood ratio test for mean difference assuming unequal variance

2014-01-13 Thread Ben Bolker
Amanda Li uchicago.edu> writes: > > Hello, > > I am so sorry, but I have been struggling with > the code for the entire day. > > I have a very simple dataset that looks like this: > response=c(45,47,24,35,47,56,29) > sub=c("A","A","B","B","C","C","C"£© > time=c(1,2,1,2,1,2,3) > gdata=cbind(re

Re: [R] Likelihood

2013-05-03 Thread S Ellison
> I have run a regression and want to calculate the likelihood > of obtaining the sample. > Is there a way in which I can use R to get this likelihood value? See ?logLik And see also ?help.search and ??. You would have found the above by typing ??likelihood at the command line in R S Ellison

Re: [R] Likelihood ratio

2012-11-10 Thread David Winsemius
On Nov 10, 2012, at 11:57 AM, bgnumis bgnum wrote: > Hi All > > > I have to run multiple stimations and to compute Likelihhod ratio. > > If I compute ls function with coef and summary I can extract "outputs" that > I need. Do you mean "lm"? > > I am not able to find something similar to lo

Re: [R] likelihood function involving integration, error in nlm

2012-10-19 Thread stats12
Thanks for pointing that out. Made some modifications and it worked. -- View this message in context: http://r.789695.n4.nabble.com/likelihood-function-involving-integration-error-in-nlm-tp4646697p4646764.html Sent from the R help mailing list archive at Nabble.com. ___

Re: [R] likelihood function involving integration, error in nlm

2012-10-19 Thread Berend Hasselman
On 19-10-2012, at 04:40, stats12 wrote: > Dear R users, > > I am trying to find the mle that involves integration. > > I am using the following code and get an error when I use the nlm function > > d<-matrix(c(1,1,0,0,0,0,0,0,2,1,0,0,1,1,0,1,2,2,1,0),nrow=10,ncol=2) > h<-matrix(runif(20,0,1),

Re: [R] Likelihood ratio test

2011-06-12 Thread Achim Zeileis
On Sun, 12 Jun 2011, Jorge Ivan Velez wrote: Hi Diviya, Take a look at the lrtest function in the lmtest package: install.packages('lmtest) require(lmtest) ?lrtest Yes, when you have to nls() fits, say m1 and m2, you can do lrtest(m1, m2) However, I don't think that both m1 and m2 can be i

Re: [R] Likelihood ratio test

2011-06-12 Thread Jorge Ivan Velez
Hi Diviya, Take a look at the lrtest function in the lmtest package: install.packages('lmtest) require(lmtest) ?lrtest HTH, Jorge On Sun, Jun 12, 2011 at 1:16 PM, Diviya Smith <> wrote: > Hello there, > > I want to perform a likelihood ratio test to check if a single exponential > or a sum of

Re: [R] likelihood ratio test

2011-05-26 Thread Ben Bolker
karuna m yahoo.com> writes: > Can anybody tell me which R package has Lo-Mendell Rubin LR test and > Bootstrap > LR test to compare the model fit between k class and k+1 class model > for Latent class analysis? I don't know, but library("sos") findFn("Lo-Mendell") findFn("{latent class ana

Re: [R] Likelihood of deviation

2011-03-25 Thread David Winsemius
On Mar 25, 2011, at 12:17 PM, Michael Hecker wrote: Hi, I have a dataset of 78.903 news articles pertaining to 340 corporate takeovers. Mean 231.3871 [articles per takeover] Std. Dev. 673.6395 I would like to calculate the probability of a certain number of news articles if I had more tak

Re: [R] Likelihood ratio based confidence intervals for logistic regression

2010-04-30 Thread Peter Ehlers
On 2010-04-30 12:42, jh556 wrote: Some quick googling suggests that they are the same thing. Thanks for the help! And note that profile likelihood CIs are produced by default on glm objects, i.e. R uses MASS's confint.glm for glm objects. confint.default(your model) let's you compare with Wa

Re: [R] Likelihood ratio based confidence intervals for logistic regression

2010-04-30 Thread jh556
Some quick googling suggests that they are the same thing. Thanks for the help! -- View this message in context: http://r.789695.n4.nabble.com/Likelihood-ratio-based-confidence-intervals-for-logistic-regression-tp2077303p2077354.html Sent from the R help mailing list archive at Nabble.com. ___

Re: [R] Likelihood ratio based confidence intervals for logistic regression

2010-04-30 Thread Erik Iverson
jh556 wrote: I'm applying logistic regression to a moderate sized data set for which I believe Wald based confidence intervals on B coefficients are too conservative. Some of the literature recommends using confidence intervals based on the likelihood ratio in such cases, but I'm having diffic

Re: [R] likelihood ratio test between glmer and glm

2010-03-14 Thread Ben Bolker
Davnah Urbach dartmouth.edu> writes: > Thanks for this answer but does that mean that working > with the deviances is better? Or how else could I > evaluate the importance of my random terms? You should probably (a) search the archives of the r-sig-mixed-models mailing list and (b) ask this

Re: [R] likelihood ratio test between glmer and glm

2010-03-14 Thread Davnah Urbach
> Thanks for this answer but does that mean that working with the deviances is better? Or how else could I evaluate the importance of my random terms? Many thanks, Davnah > On Mar 14, 2010, at 8:12 PM, hadley wickham wrote: > >>> Based on a discussion found on the R mailing list but dating

Re: [R] likelihood ratio test between glmer and glm

2010-03-14 Thread hadley wickham
> Based on a discussion found on the R mailing list but dating back to 2008, I > have compared the log-likelihoods of the glm model and of the glmer model as > follows: > > lrt <- function (obj1, obj2){ > L0 <- logLik(obj1) > L1 <- logLik(obj2) > L01 <- as.vector(- 2 * (L0 - L1)) > df <- attr(L1,

Re: [R] Likelihood Ratio Tests

2010-01-04 Thread Peter Dalgaard
Jim Silverton wrote: Is there any package available in R to do the following hypothesis tests? Testing the means of two Poissons (equivalent to the difference of two proportions) Testing the equality of two proportions from binomials Testing the equality of proprtions of two negative binomials (

Re: [R] Likelihood Ratio Tests

2010-01-03 Thread Jim Silverton
Is there any package available in R to do the following hypothesis tests? Testing the means of two Poissons (equivalent to the difference of two proportions) Testing the equality of two proportions from binomials Testing the equality of proprtions of two negative binomials (both conditional and un

Re: [R] Likelihood Function for Multinomial Logistic Regression and its partial derivatives

2009-08-02 Thread nikolay12
Thanks, I had a look at mlogit. It seems it does fit a multinomial logit regression but - just as nnet or VGAM are doing it - it has a function that tells you the fitted value, not the value that you have with a set of parameters (which might not be the optimal ones). Or am I wrong on this? Rong

Re: [R] Likelihood Function for Multinomial Logistic Regression and its partial derivatives

2009-08-02 Thread nikolay12
Thanks for the book suggestion. I'll check it out tomorrow when the library opens up. Yes, it is a multilevel model, but its likelihood function is the sum of the likelihood functions for the individual levels (i.e. a simple multinomial logits) and some other terms (the priors). It is, essential

Re: [R] Likelihood Function for Multinomial Logistic Regression and its partial derivatives

2009-08-02 Thread Ronggui Huang
You may refer to mlogit for the ordinary multinomial regression. As fas as I know, there are no functions for multilevel multinomial regression. Ronggui 2009/8/2 nikolay12 : > > Hi, > > I would like to apply the L-BFGS optimization algorithm to compute the MLE > of a multilevel multinomial Logist

Re: [R] Likelihood Function for Multinomial Logistic Regression and its partial derivatives

2009-08-02 Thread markleeds
Hi: John Fox's CAR book has some very nice examples of how the multinomial likelihood is estimated computationally speaking. But you mentioned multilevel earlier which sounds more complex ? On Aug 2, 2009, nikolay12 wrote: Thanks a lot. The info about computing the gradient

Re: [R] Likelihood Function for Multinomial Logistic Regression and its partial derivatives

2009-08-02 Thread nikolay12
Thanks a lot. The info about computing the gradient will be helpful. I admit that I am somewhat confused about the likelihood function itself. It is often said that you need to set a reference category. However, I found two different implementations in Matlab for which setting the reference categ

Re: [R] Likelihood Function for Multinomial Logistic Regression and its partial derivatives

2009-08-02 Thread Ravi Varadhan
Hi, Providing the gradient function is generally a good idea in optimization; however, it is not necessary. Almost all optimization routines will compute this using a simple finite-difference approximation, if they are not user-specified. If your function is very complicated, then you are more

Re: [R] Likelihood of a ridge regression (lm.ridge)?

2009-03-18 Thread Ravi Varadhan
Joris, Ridge regression is a type of regularized estimation approach. The objective function for least-squares, (Y - Xb)^t (Y - Xb) is modified by adding a quadratic penalty, k b^t b. Because of this the log-likelihood value (sum of squared residuals), for a fixed k, does not have much meanin

Re: [R] Likelihood ratio test using R

2008-11-04 Thread C.H.
For the third one: ?anova.glm test=Chisq will be LRT. For the first two, you can have the answer from ordinary stat book. On Wed, Nov 5, 2008 at 1:11 PM, Maithili Shiva <[EMAIL PROTECTED]> wrote: > Hi! > > I am working on the Logistic Regression using R. My R script is as follows > > > ONS <-

Re: [R] Likelihood between observed and predicted response

2008-09-22 Thread Ben Bolker
Christophe LOOTS ifremer.fr> writes: > > Thank you so much for your help. > > The function "dbinom" seems to work very well. > > However, I'm a bit lost with the "dnorm" function. > > Apparently, I have to compute the mean "mu" and the standard deviation > "sd" but what does it mean exactly?

Re: [R] Likelihood ratio test between glm and glmer fits

2008-07-19 Thread Göran Broström
This particular case with a random intercept model can be handled by glmmML, by bootstrapping the p-value. Best, Göran On Thu, Jul 17, 2008 at 1:29 PM, Douglas Bates <[EMAIL PROTECTED]> wrote: > On Thu, Jul 17, 2008 at 2:50 AM, Rune Haubo <[EMAIL PROTECTED]> wrote: >> 2008/7/16 Dimitris Rizopoulo

Re: [R] Likelihood ratio test between glm and glmer fits

2008-07-17 Thread Douglas Bates
On Thu, Jul 17, 2008 at 2:50 AM, Rune Haubo <[EMAIL PROTECTED]> wrote: > 2008/7/16 Dimitris Rizopoulos <[EMAIL PROTECTED]>: >> well, for computing the p-value you need to use pchisq() and dchisq() (check >> ?dchisq for more info). For model fits with a logLik method you can directly >> use the foll

Re: [R] Likelihood ratio test between glm and glmer fits

2008-07-17 Thread Rune Haubo
2008/7/16 Dimitris Rizopoulos <[EMAIL PROTECTED]>: > well, for computing the p-value you need to use pchisq() and dchisq() (check > ?dchisq for more info). For model fits with a logLik method you can directly > use the following simple function: > > lrt <- function (obj1, obj2) { >L0 <- logLik(

Re: [R] Likelihood ratio test between glm and glmer fits

2008-07-16 Thread Dimitris Rizopoulos
well, for computing the p-value you need to use pchisq() and dchisq() (check ?dchisq for more info). For model fits with a logLik method you can directly use the following simple function: lrt <- function (obj1, obj2) { L0 <- logLik(obj1) L1 <- logLik(obj2) L01 <- as.vector(- 2 *

Re: [R] Likelihood between observed and predicted response

2008-05-14 Thread Ben Bolker
Christophe LOOTS ifremer.fr> writes: > > Hi, > > I've two fitted models, one binomial model with presence-absence data > that predicts probability of presence and one gaussian model (normal or > log-normal abundances). > > I would like to evaluate these models not on their capability of > a

Re: [R] Likelihood optimization numerically

2008-01-27 Thread Mohammad Ehsanul Karim
Dear List, Probably i am missing something important in optimize: llk.1st <- function(alpha){ x <- c(20.0, 23.9, 20.9, 23.8, 25.0, 24.0, 21.7, 23.8, 22.8, 23.1, 23.1, 23.5, 23.0, 23.0) n <- length(x) llk1 <- -n*log(gamma(alpha)) - n*alpha*log(sum(x)/(n*alpha)) + (alpha - 1)*(sum(log(x))) - (su

Re: [R] Likelihood optimization numerically

2008-01-26 Thread Bill.Venables
You asked for a hint. > library(MASS) > x <- c(20.0, 23.9, 20.9, 23.8, 25.0, 24.0, 21.7, 23.8, 22.8, 23.1, 23.1, 23.5, 23.0, 23.0) > fitdistr(x, "gamma") shape rate 316.56387213.780766 (119.585534) ( 5.209952) To do it with more general and e

Re: [R] likelihood from test result

2008-01-10 Thread Matthias Kohl
Dear David, no, distrTEst won't help. It has a different intention. We are currently working on a new package "distrMod" (cf. https://r-forge.r-project.org/projects/distrmod/) which sometime might have such a functionality. Best, Matthias David Bickel wrote: > Is there any automatic mechanism f

Re: [R] likelihood from test result

2008-01-09 Thread Peter Dalgaard
David Bickel wrote: > Is there any automatic mechanism for extracting a likelihood or test > statistic distribution (PDF or CDF) from an object of class "htest" or > from another object of a general class encoding a hypothesis test > result? > > I would like to have a function that takes "x", an ob

Re: [R] likelihood from test result

2008-01-09 Thread Gabor Grothendieck
You could create an S3 generic that does it. That is not initially any less work than the if statement but if you add new distribution no existing code need be modified. Just add a new method for each distribution to be supported: getDistr <- function(x) { .Class <- names(x$value$statist

Re: [R] Likelihood ratio test for proportional odds logistic regression

2008-01-05 Thread Prof Brian Ripley
On Sat, 5 Jan 2008, xinyi lin wrote: > Hi, > > I want to do a global likelihood ratio test for the proportional odds > logistic regression model and am unsure how to go about it. I am using > the polr() function in library(MASS). > > 1. Is the p-value from the likelihood ratio test obtained by > a

Re: [R] Likelihood ration test on glm

2007-09-21 Thread Charles C. Berry
On Fri, 21 Sep 2007, Wensui Liu wrote: > chris, > as long as you know the log likelihood functions and the # of > parameters in both models, a pencil and a piece of paper should be > enough to calculate LR test. True enough for the LR statistic. Or follow the instructions in the _posting guide_

Re: [R] Likelihood ration test on glm

2007-09-21 Thread Wensui Liu
chris, as long as you know the log likelihood functions and the # of parameters in both models, a pencil and a piece of paper should be enough to calculate LR test. On 9/21/07, Chris Elsaesser <[EMAIL PROTECTED]> wrote: > I would like to try a likelihood ratio test in place of waldtest. > Ideally

Re: [R] Likelihood ration test on glm

2007-09-21 Thread Kevin E. Thorpe
Chris Elsaesser wrote: > I would like to try a likelihood ratio test in place of waldtest. > Ideally I'd like to provide two glm models, the second a submodel of the > first, in the style of lrt > (http://www.pik-potsdam.de/~hrust/tools/farismahelp/lrt.html). [lrt > takes farimsa objects] > > Does