similar to: Loglikelihood for x factorial?

Displaying 20 results from an estimated 1000 matches similar to: "Loglikelihood for x factorial?"

2008 Sep 24
2
Bug in "is" ?
Hi R users Is there anything wrong in "is" function? (R 2.7.2) I believe that everyone will agree that "7" is an integer, right? but why R shows 7 is not an integer > is.integer(7) [1] FALSE > is(7,"integer") [1] FALSE > is(as.integer(7), "integer") [1] TRUE Thank you very much in advance Chunhao
2008 Sep 24
2
Bug in "is" ?
Hi R users Is there anything wrong in "is" function? (R 2.7.2) I believe that everyone will agree that "7" is an integer, right? but why R shows 7 is not an integer > is.integer(7) [1] FALSE > is(7,"integer") [1] FALSE > is(as.integer(7), "integer") [1] TRUE Thank you very much in advance Chunhao
2008 Sep 02
1
correlation with boot
Hi R users, I have one simple question but I really don't know why I can't get it work. The data was adopted from Efron's An introduction to the bootstrap book. > nlaw LSAT GPA [1,] 576 3.39 [2,] 635 3.30 [3,] 558 2.81 [4,] 578 3.03 [5,] 666 3.44 [6,] 580 3.07 [7,] 555 3.00 [8,] 661 3.43 [9,] 651 3.36 [10,] 605 3.13 [11,] 653 3.12 [12,] 575 2.74
2008 Sep 06
1
Help use try function with boot
Hi R users, Is is possible for me to use the try function with boot? I would to do the bootstraping with a nonlinear model(it works well when R < 1000). But it does not work very well (when R is large) thus I try to use "try" to resolve. I put the try function in two cases: case1: put the try in front of the boot > c1.try<-try(boot(c1data, statistic = c1.fun,
2008 Sep 09
1
S.O.S "try" doesnot work in boot?
First thanks for Jinsong's suggestions I would like to do a bootstrap in a nonlinear model. But it fails to converge in most of time. (it did converge if I just use nls without boot). Thus, I use "try" function to resolve my problem. This following code is from Jinsong's suggestion. h1a.nls<-nls(density~nmf(time, alpha, delta, psi, tau, gamma),data=h1a,
2008 May 25
1
How to write a package based on nlme
Dear R Helpers, I try to write a small package that based on nlme however my code does not work. R always appears this message: Error in eval(expr, envir, enclos) : object "y" not found where y is the response variable. Please help me out! This is my code: require(nlme) AMPmixed<-function(y, x, S1=c("asymptotic","logistic"), random,data,
2011 May 12
1
Maximization of a loglikelihood function with double sums
Dear R experts, Attached you can find the expression of a loglikelihood function which I would like to maximize in R. So far, I have done maximization with the combined use of the mathematical programming language AMPL (www.ampl.com) and the solver SNOPT (http://www.sbsi-sol-optimize.com/manuals/SNOPT%20Manual.pdf). With these tools, maximization is carried out in a few seconds. I wonder if that
2006 Nov 15
1
OPTIM--non finite finite different [13]
Dear All: I used optim() to minimise the loglikelihood function for fitting data to negative binomial distribution. But there initial value of log-likelihood and iteration 10 value are reasonable. for example: initial value 1451657.994524 iter 10 value 47297.534905 iter 20 value -623478636.8236478 Then the iter 20 vlaue suddelnly changes to a negative value and in the end the error mesage is
2011 Apr 15
3
GLM output for deviance and loglikelihood
It has always been my understanding that deviance for GLMs is defined by; D = -2(loglikelihood(model) - loglikelihood(saturated model)) and this can be calculated by (or at least usually is); D = -2(loglikelihood(model)) As is done so in the code for 'polr' by Brian Ripley (in the package 'MASS') where the -loglikehood is minimised using optim; res <-
2006 Mar 31
1
loglikelihood and lmer
Dear R users, I am estimating Poisson mixed models using glmmPQL (MASS) and lmer (lme4). We know that glmmPQL do not provide the correct loglikelihood for such models (it gives the loglike of a 'pseudo' or working linear mixed model). I would like to know how the loglike is calculated by lmer. A minor question is: why do glmmPQL and lmer give different degrees-of-freedom for the same
2008 Jul 30
2
Repeated Measure ANOVA-Old question
Hi R users, I google the website and I found that there are three ways to perform repeated measure ANOVA: aov, lme and lmer. http://www.mail-archive.com/r-help at stat.math.ethz.ch/msg58502.html But the questions are which one is good to use and how to do post-hoc test? I use the example that is provided in the above link and I try > tt<-aov(p.pa~group*time+Error(subject/time),data=P.PA)
2008 Jul 08
0
Fwd: Re: extracting index list when using tapply()
The following message is provided by Erik Please provide the reproducible code to do this. Generate a sample data set using the random data generating functions and show us what you'd like, we can then more easily help. ctu at bigred.unl.edu wrote: > Hi, > How about using "subset"? > x1<-tapply(subset(years, length(area)>20), function(x) length(unique(x))) >
2011 Mar 14
0
nlysystemfit and loglikelihood values
Dear R-help, The documentation for systemfit shows that logLik() can be used to obtain loglikelihood values from linear systems estimated by systemfit(). It seems to me that logLik() cannot be used for nlsystemfit(). Does anyone know of any other packages that might let me obtain the loglikelihood of a model estimated with nlsystemfit()? Kind regards, Alex Olssen
2001 Dec 04
3
factorial() not here (PR#1194)
Version 1.3.1 (2001-08-31) factorial() is not in R. It is in S-Plus with the definition factorial <- function(n) gamma(n + 1) -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not
2010 Sep 05
2
Need Help .RData in Mac OS X, Please
Hi R Users, I was accidentally save R file when I quit R program. I try to delete but I am not sure the R saved file was successfuly delete or not. Now everyt time when I open the R, it always appears [R.app GUI 1.34 (5589) i386-apple-darwin9.8.0] [Workspace restored from /Users/ctu/.RData] I have read google, R help and Nabble but I still can't solve this problem. Could someone please
2010 Dec 07
1
Using nlminb for maximum likelihood estimation
I'm trying to estimate the parameters for GARCH(1,1) process. Here's my code: loglikelihood <-function(theta) { h=((r[1]-theta[1])^2) p=0 for (t in 2:length(r)) { h=c(h,theta[2]+theta[3]*((r[t-1]-theta[1])^2)+theta[4]*h[t-1]) p=c(p,dnorm(r[t],theta[1],sqrt(h[t]),log=TRUE)) } -sum(p) } Then I use nlminb to minimize the function loglikelihood: nlminb(
2011 Jun 08
2
Results of CFA with Lavaan
I've just found the lavaan package, and I really appreciate it, as it seems to succeed with models that were failing in sem::sem. I need some clarification, however, in the output, and I was hoping the list could help me. I'll go with the standard example from the help documentation, as my problem is much larger but no more complicated than that. My question is, why is there one latent
2012 Nov 30
2
NA return to NLM routine
Hello, I am trying to understand a small quirk I came across in R. The following code results in an error: k <- c(2, 1, 1, 5, 5) f <- c(1, 1, 1, 3, 2) loglikelihood <- function(theta,k,f){ if( theta<1 && theta>0 ) return(-1*sum(log(choose(k,f))+f*log(theta)+(k-f)*log(1-theta))) return(NA) } nlm(loglikelihood ,0.5, k, f ) Running this code results in: Error
2007 May 24
3
Problem with numerical integration and optimization with BFGS
Hi R users, I have a couple of questions about some problems that I am facing with regard to numerical integration and optimization of likelihood functions. Let me provide a little background information: I am trying to do maximum likelihood estimation of an econometric model that I have developed recently. I estimate the parameters of the model using the monthly US unemployment rate series
2008 Apr 18
2
rzinb (VGAM) and dnbinom in optim
Dear R-help gurus (and T.Yee, the VGAM maintainer) - I've been banging my head against the keyboard for too long now, hopefully someone can pick up on the errors of my ways... I am trying to use optim to fit a zero-inflated negative binomial distribution. No matter what I try I can't get optim to recognize my initial parameters. I think the problem is that dnbinom allows either