similar to: loglilelihood

Displaying 20 results from an estimated 500 matches similar to: "loglilelihood"

2009 Jun 06
0
loglikelihood and AIC
Hi,  I tried fitting loglinear model using the glm(catspec). The data used is FHtab. . An independence model was fitted. Here summary() and fitmacro( ) give different values for AIC.   I understand that fitmacro( ) takes the likelilhood ratio L2(deviance) to calculate AIC and uses the formula AIC= L2- d.f(deviance)*2 and this AIC is used for comparison of nested models. (Am I right?)   The value
2005 Apr 15
2
abbreviate or wrap dimname labels
For a variety of displays (mosaicplots, barplots, ...) one often wants to either abbreviate or wrap long labels, particularly when these are made up of several words. In general, it would be nice to have a function, abbreviate.or.wrap <- function(x, maxlength=10, maxlines=2, split=" ") { } that would take a character vector or a list of vectors, x, and try to abbreviate or wrap
2005 Apr 12
0
New version of "catspec" package
I've uploaded a new version of "catspec" to CRAN. Catspec is for estimating certain "special categorical" models. It also contains "ctab", a function for creating one-way, two-way, and multi-way percentage tables (nothing special there really). Ctab can now print more than one percentage type, as well as table marginals. The first special model in catspec is
2005 Apr 12
0
New version of "catspec" package
I've uploaded a new version of "catspec" to CRAN. Catspec is for estimating certain "special categorical" models. It also contains "ctab", a function for creating one-way, two-way, and multi-way percentage tables (nothing special there really). Ctab can now print more than one percentage type, as well as table marginals. The first special model in catspec is
2012 Feb 17
3
stepwise selection for conditional logistic regression
 Hi, Is there any function available to do stepwise selection of variables in Conditional(matched) logistic regression( clogit)? step, stepwise  etc are failing in case of conditional logistic regression. Please help.  Thanks P.T. Subha [[alternative HTML version deleted]]
2006 Oct 27
1
(no subject)
Hi, I have generated a profile likelihood for a parameter (x) and am trying to get 95% confidence limits by calculating the two points where the log likelihood (LogL) is 2 units less than the maximum LogL. I would like to do this by linear interpolation and so I have been trying to use the function approxfun which allows me to get a function to calculate LogL for any value of x within
2008 Sep 11
0
Loop for the convergence of shape parameter
Hello, The likelihood includes two parameters to be estimated: lambda (=beta0+beta1*x) and alpha. The algorithm for the estimation is as following: 1) with alpha=0, estimate lambda (estimate beta0 and beta1 via GLM) 2) with lambda, estimate alpha via ML estimation 3) with updataed alpha, replicate 1) and 2) until alpha is converged to a value I coded 1) and 2) (it works), but faced some
2005 May 31
1
Solved: linear regression example using MLE using optim()
Thanks to Gabor for setting me right. My code is as follows. I found it useful for learning optim(), and you might find it similarly useful. I will be most grateful if you can guide me on how to do this better. Should one be using optim() or stats4::mle? set.seed(101) # For replicability # Setup problem X <- cbind(1, runif(100)) theta.true <- c(2,3,1) y <- X
2007 Jun 19
1
Error handling
Hello, I have a question about error handling. I run simulation studies and often the program stops with an error, for example during maximum likelihood. I would like the program not to stop but to continue and I would like to ask how the error handling can be set up for this (if it can). I tried to look through manuals etc but unfortunately did not get closer to the solution. Below is a
2008 Dec 31
2
function of mixture normal with covariates
Hello, My name is Julia and I'm doing my phd on roc analysis. I'm trying to write a maximization function for the likelihood attached in the document. For some reason it's not working I keep getting \this error: Error: unexpected symbol in: " +log(v_pred)) return" > } Error: unexpected '}' in "}" > >
2010 Jul 07
3
Boxplots over a Scatterplot
Hello- I'm new to R, coding and stats. (Oh no.) Anyway, I have about 12000 data points in a data.frame (dealing with dimensions and geological stage information for fossil protists) and have plotted them in a basic scatter plot. I also added a boxplot to overlay these points. Each worked fine independently, but when I attempt to superimpose them with add=true, I get a different scale for
2006 Mar 13
1
Formatting an anova table using latex
Hi r-helpers, When I issue the command latex(anova(raw1.lmer0, raw1.lmer, raw1.lmerI), file = 'raw1.tex', rownamesTexCmd = c('baR', 'addit', 'multip'), longtable = F, dcolumn = T, booktabs = T, t able.env = F, colheads = NULL, colnamesTexCmd = c ('', 'df', 'aic', 'bic', 'logl', 'chisq', 'chisqdf',
2005 Jun 29
2
MLE with optim
Hello, I tried to fit a lognormal distribution by using optim. But sadly the output seems to be incorrect. Who can tell me where the "bug" is? test = rlnorm(100,5,3) logL = function(parm, x,...) -sum(log(dlnorm(x,parm,...))) start = list(meanlog=5, sdlog=3) optim(start,logL,x=test)$par Carsten. [[alternative HTML version deleted]]
2009 Jul 01
2
Difficulty in calculating MLE through NLM
Hi R-friends, Attached is the SAS XPORT file that I have imported into R using following code library(foreign) mydata<-read.xport("C:\\ctf.xpt") print(mydata) I am trying to maximize logL in order to find Maximum Likelihood Estimate (MLE) of 5 parameters (alpha1, beta1, alpha2, beta2, p) using NLM function in R as follows. # Defining Log likelihood - In the function it is noted as
2011 Dec 01
1
Estimation of AR(1) Model with Markov Switching
Dear R users, I have been trying to obtain the MLE of the following model state 0: y_t = 2 + 0.5 * y_{t-1} + e_t state 1: y_t = 0.5 + 0.9 * y_{t-1} + e_t where e_t ~ iidN(0,1) transition probability between states is 0.2 I've generated some fake data and tried to estimate the parameters using the constrOptim() function but I can't get sensible answers using it. I've tried using
2005 Aug 12
0
HowTo derive a correct likelihood-ratio chi-squared statistic from lrm() with a rsc() ?
Dear R helpers, >From the lrm( ) model used for binary logistic regression, we used the L.R. model value (or the G2 value, likelihood-ratio chi-squared statistic) to evaluate the goodness-of-fit of the models. The model with the lowest G2 value consequently, has the best performance and the highest accuracy. However our model includes rsc() functions to account for non-linearity. We
2008 Aug 12
2
Maximum likelihood estimation
Hello, I am struggling for some time now to estimate AR(1) process for commodity price time series. I did it in STATA but cannot get a result in R. The equation I want to estimate is: p(t)=a+b*p(t-1)+error Using STATA I get 0.92 for a, and 0.73 for b. Code that I use in R is: p<-matrix(data$p) # price at time t lp<-cbind(1,data$lp) # price at time t-1
2005 May 30
1
Trying to write a linear regression using MLE and optim()
I wrote this: # Setup problem x <- runif(100) y <- 2 + 3*x + rnorm(100) X <- cbind(1, x) # True OLS -- lm(y ~ x) # OLS likelihood function -- ols.lf <- function(theta, K, y, X) { beta <- theta[1:K] sigma <- exp(theta[K+1]) e <- (y - X%*%beta)/sigma logl <- sum(log(dnorm(e))) return(logl) } optim(c(2,3,0), ols.lf, gr=NULL, method="BFGS",
2010 Mar 26
1
Problems if optimization
What's up fellows... I am a begginer in R and i am trying to find the parameters of one likelihood function, but when i otimize it, always appers a error or advertisement and the solve does not occur. The problem seems like that: "lMix<-function(pars,y){ beta1<-pars[1] beta2<-pars[2] beta3<-pars[3] beta4<-pars[4] beta5<-pars[5] alfa1<-pars[6]
2005 Nov 18
1
Truncated observations in survreg
Dear R-list I have been trying to make survreg fit a normal regression model with left truncated data, but unfortunately I am not able to figure out how to do it. The following survreg-call seems to work just fine when the observations are right censored: library(survival) n<-100000 #censored observations x<-rnorm(n) y<-rnorm(n,mean=x) d<-data.frame(x,y) d$ym<-pmin(y,0.5)