similar to: Degrees of freedom for lm in logLik and AIC

Displaying 20 results from an estimated 10000 matches similar to: "Degrees of freedom for lm in logLik and AIC"

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)
2003 Jun 25
3
logLik.lm()
Hello, I'm trying to use AIC to choose between 2 models with positive, continuous response variables and different error distributions (specifically a Gamma GLM with log link and a normal linear model for log(y)). I understand that in some cases it may not be possible (or necessary) to discriminate between these two distributions. However, for the normal linear model I noticed a discrepancy
2007 Aug 17
0
(Ben Bolker) AIC and logLik for logistic regression in R and S-PLUS
Leandra Desousa <sousa <at> ims.uaf.edu> writes: >> > 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: >> > >> > >summary(mydata.glm) >> > Call: >> > glm(formula = COMU ~
2008 Mar 05
1
degrees of freedom extraction
Hello, II used the logLik() function to get the log-likelihood estimate of an object. The function also prints the degrees of freedom. How can I extract the degrees of freedom and assign it to a variable. Below is the output: > logLik(fit2pl) 'log Lik.' -4842.912 (df=36) Thanks, Davood Tofighi [[alternative HTML version deleted]]
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=
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 Nov 02
0
stepAIC and AIC question
I have a question about stepAIC and extractAIC and why they can produce different answers. Here's a stepAIC result (slightly edited - I removed the warning about noninteger #successes): stepAIC(glm(formula = (Morbid_70_79/Present_70_79) ~ 1 + Cohort + Cohort2, family = binomial, data = ghs_70_79, subset = ghs_70_full),direction = c("backward")) Start: AIC=3151.41
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
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 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
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
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
2012 May 31
1
Higher log-likelihood in null vs. fitted model
Two related questions. First, I am fitting a model with a single predictor, and then a null model with only the intercept. In theory, the fitted model should have a higher log-likelihood than the null model, but that does not happen. See the output below. My first question is, how can this happen? > m Call: glm(formula = school ~ sv_conform, family = binomial, data = dat, weights =
2006 Feb 07
1
sampling and nls formula
Hello, I am trying to bootstrap a function that extracts the log-likelihood value and the nls coefficients from an nls object. I want to sample my dataset (pdd) with replacement and for each sampled dataset, I want to run nls and output the nls coefficients and the log-likelihood value. Code: x<-c(1,2,3,4,5,6,7,8,9,10) y<-c(10,11,12,15,19,23,26,28,28,30) pdd<-data.frame(x,y)
2006 Oct 18
1
lmer- why do AIC, BIC, loglik change?
Hi all, I am having issues comparing models with lmer. As an example, when I run the code below the model summaries (AIC, BIC, loglik) differ between the summary() and anova() commands. Can anyone clear up what's wrong? Thank you! Darren Ward library(lme4) data(sleepstudy) fm1<-lmer(Reaction ~ Days + (1|Subject), sleepstudy) summary(fm1) fm2<-lmer(Reaction ~ Days +
2007 Mar 06
2
Estimating parameters of 2 phase Coxian using optim
Hi, My name is Laura. I'm a PhD student at Queen's University Belfast and have just started learning R. I was wondering if somebody could help me to see where I am going wrong in my code for estimating the parameters [mu1, mu2, lambda1] of a 2-phase Coxian Distribution. cox2.lik<-function(theta, y){ mu1<-theta[1] mu2<-theta[2] lambda1<-theta[3]
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
2010 May 28
1
Comparing and Interpreting GAMMs
Dear R users I have a question related to the interpretation of results based on GAMMs using Simon Woods package gamm4. I have repeated measurements (hours24) of subjects (vpnr) and one factor with three levels (pred). The outcome (dv) is binary. In the first model I'd like to test for differences among factor levels (main effects only): gamm.11<-gamm4(dv ~ pred +s(hours24), random = ~
2012 Jan 27
2
Why does the order of terms in a formula translate into different models/ model matrices?
Dear all, I have encountered some strange things when creating lm objects in R: model depends on the order of the terms specified in a formula. Let us consider the following simple example: > dat <- expand.grid(A = factor(c("a1", "a2")), + B = factor(paste("b", 1:4, sep="")), + rep = factor(1:2)) >
2009 Jun 12
1
Function for AIC or logLIK for nlsList object
Dear R users, Does anybody have a function to calculate logLik or AIC for nlsList objects? After receiving error messages, another user helped me ascertain that this function is not currently written into R. Many thanks Lindsay