Displaying 20 results from an estimated 10000 matches similar to: "logLik.lm()"
2009 Feb 25
3
indexing model names for AICc table
hi folks,
I'm trying to build a table that contains information about a series of
General Linear Models in order to calculate Akaike weights and other
measures to compare all models in the series.
i have an issue with indexing models and extracting the information
(loglikehood, AIC's, etc.) that I need to compile them into the table.
Below is some sample code that illustrates my
2007 Jan 03
1
problem with logLik and offsets
Hi,
I'm trying to compare models, one of which has all parameters fixed
using offsets. The log-likelihoods seem reasonble in all cases except
the model in which there are no free parameters (model3 in the toy
example below). Any help would be appreciated.
Cheers,
Jarrod
x<-rnorm(100)
y<-rnorm(100, 1+x)
model1<-lm(y~x)
logLik(model1)
sum(dnorm(y, predict(model1),
2005 Apr 19
1
behaviour of logLik and lme
Dear all,
when performing a meta analysis I have two results obtained with logLik
and lme, which I do not quite understand.
The results are based on these data:
study or var
1 0.10436 0.299111
2 -0.03046 0.121392
3 0.76547 0.319547
4 -0.19845 0.025400
5 -0.10536 0.025041
6 -0.11653 0.040469
7 0.09531 0.026399
8 0.26236 0.017918
9 -0.26136 0.020901
10 0.45742 0.035877
11
2004 Mar 09
4
aic calculation
hello,
could somebody refer me to the reason R uses
-2*loglik + 2*(#param)+2
to calculate AIC?
thank you
--
Stoyan Iliev
2013 May 21
1
Calculating AIC for the whole model in VAR
Hello!
I am using package "VAR".
I've fitted my model:
mymodel<-VAR(mydata,myp,type="const")
I can extract the Log Liklihood for THE WHOLE MODEL:
logLik(mymodel)
How could I calculate (other than manually) the corresponding Akaike
Information Criterion (AIC)?
I tried AIC - but it does not take mymodel:
AIC(mymodel)
# numeric(0)
Thank you!
--
Dimitri Liakhovitski
2011 Mar 28
1
Degrees of freedom for lm in logLik and AIC
I have a question about the computation of the degrees of freedom in a linear
model:
x <- runif(20); y <- runif(20)
f <- lm(y ~ x)
logLik(f)
'log Lik.' -1.968056 (df=3)
The 3 is coming from f$rank + 1. Shouldn't it be f$rank? This affects
AIC(f).
Thanks
Frank
-----
Frank Harrell
Department of Biostatistics, Vanderbilt University
--
View this message in context:
2007 Aug 15
1
AIC and logLik for logistic regression in R and S-PLUS
Dear R users,
I am using 'R' version 2.2.1 and 'S-PLUS' version 6.0; and I loaded the
MASS library in 'S-PLUS'.
I am running a logistic regression using glm:
---------------------------------------------------------------------------
> mydata.glm<-glm(COMU~MeanPycUpT+MeanPycUpS, family=binomial, data=mydata)
2008 Mar 11
1
Problem comparing Akaike's AIC - nlme package
Hello,
I am comparing models made with nlme functions and non-nlme functions, based
on Akaike's AIC. The AIC values I get for exactly the same model formulation
--for example a linear model with no random effects fit with gls and lm,
respectively-- do not fit, although the values of the four model parameters
are exactly the same. For example:
m1 <- gls(height ~ age, data = Loblolly)
m2
2005 Dec 14
3
Fitting binomial lmer-model, high deviance and low logLik
Hello
I have a problem when fitting a mixed generalised linear model with the
lmer-function in the Matrix package, version 0.98-7. I have a respons
variable (sfox) that is 1 or 0, whether a roe deer fawn is killed or not
by red fox. This is expected to be related to e.g. the density of red
fox (roefoxratio) or other variables. In addition, we account for family
effects by adding the mother
2005 Aug 08
2
AIC model selection
Hello All;
I need to run a multiple regression analysis and use Akaike's Information
Criterion for model selection. I understand that this command will give the
AIC value for specified models:
AIC(object, ..., k = 2)
with "..." meaning any other optional models for which I would like AIC
values. But, how can I specify (in the place of "...") that I want R to
2012 Oct 13
2
Function hatTrace in package lme4
Dear all,
For a project I need to calculate the conditional AIC of a mixed effects
model.
Luckily, I found a reference in the R help forum for a function to be used:
CAIC <- function(model) {
sigma <- attr(VarCorr(model), 'sc')
observed <- attr(model, 'y')
predicted <- fitted(model)
cond.loglik <- sum(dnorm(observed,
2008 Oct 14
2
help about how can R compute AIC?
Hello.
I need to know how can R compute AIC when I study a regression model?
For example, if I use these data:
growth tannin
1 12 0
2 10 1
3 8 2
4 11 3
5 6 4
6 7 5
7 2 6
8 3 7
9 3 8
and I do
model <- lm (growth ~ tannin)
AIC(model)
R responses:
38.75990
I know the following formula to compute AIC:
AIC=
2006 Feb 20
1
Nested AIC
Greetings,
I have recently come into some confusion over weather or not AIC
results for comparing among models requires that they be nested.
Reading Burnham & Anderson (2002) they are explicit that nested
models are not required, but other respected statisticians have
suggested that nesting is a pre-requisite for comparison. Could
anyone who feels strongly regarding either position
2005 Oct 29
2
LaTex error when creating DVI version when compiling package
Dear Listers,
I got this message when compiling a package:
* creating pgirmess-manual.tex ... OK
* checking pgirmess-manual.text ... ERROR
LaTex errors when creating DVI version.
This typically indicates Rd problems.
The message is quite explicit but I struggled a lot before understanding
that the trouble comes from a single file "selMod.rd" among 44 topics.
Even though I have
2002 Nov 15
2
bug in logLik.nls (PR#2295)
logLik.nls does not count the df's correct. I get df=1 although I
fit a probit-model with 3 parameters.
Example:
x <- c(-2.3, -2.0, -1.3, -1.0, -0.7, -0.3, 0.0, 0.3)
y <- c(80, 80, 54, 43, 24, 18, 12, 12)
fit.nls <- nls(y ~ diff * pnorm(beta * (x - alpha)),
start=c(alpha=-1, beta=-1, diff=100))
logLik.nls(fit.nls)
# `log Lik.' -21.43369 (df=1)
Sincerely
2012 Jan 20
1
nobs() and logLik()
Dear all,
I am studying a bit the various support functions that exist for
extracting information from fitted model objects.
From the help files it is not completely clear to me whether the number
returned by nobs() should be the same as the "nobs" attribute of the
object returned by logLik().
If so, then there is a slight inconsistency in the methods for 'nls'
objects with
2009 Jul 15
1
GLM Gamma Family logLik formula?
Hello all,
I was wondering if someone can enlighten me as to the difference
between the logLik in R vis-a-vis Stata for a GLM model with the gamma
family.
Stata calculates the loglikelihood of the model as (in R notation)
some equivalent function of
-1/scale * sum(Y/mu+log(mu)+(scale-1)*log(Y)+log(scale)+scale*lgamma(1/scale))
where scale (or dispersion) = 1, Y = the response variable, and mu
2003 Jan 15
2
Bug or Feature? LogLik.nls and non-central F distribution.
I have a dataset that I am running non-linear regression on via the
following code:
Hill <- function(E0,Em,C50,g,C){
#
# Hill is the hill interaction function.
#
# E0 Represents the minimum interaction Effect
#
# Em Represents the Maximum Interaction Effect
#
# C50 represents the concentration at which 50% of the effect occurs.
#
# gamma represents the cooperativity of the
2006 Feb 22
2
does multinomial logistic model from multinom (nnet) has logLik?
I want to get the logLik to calculate McFadden.R2 ,ML.R2 and
Cragg.Uhler.R2, but the value from multinom does not have logLik.So my
quetion is : is logLik meaningful to multinomial logistic model from
multinom?If it does, how can I get it?
Thank you!
ps: I konw VGAM has function to get the multinomial logistic model
with logLik, but I prefer use the function from "official" R
2008 Nov 28
2
AIC function and Step function
I would like to figure out the equations for calculating "AIC" in both
"step() function" and "AIC () function". They are different. Then I
just type "step" in the R console, and found the "AIC" used in "step()
function" is "extractAIC". I went to the R help, and found:
"The criterion used is
AIC = - 2*log L + k *