Displaying 20 results from an estimated 2000 matches similar to: "An AIC model selection question"
2008 Nov 25
4
glm or transformation of the response?
Dear all,
For an introductory course on glm?s I would like to create an example to show the difference between
glm and transformation of the response. For this, I tried to create a dataset where the variance
increases with the mean (as is the case in many ecological datasets):
poissondata=data.frame(
response=rpois(40,1:40),
explanatory=1:40)
attach(poissondata)
However, I have run into
2008 Nov 06
2
replacing characters in formulae / models
Dear all,
How can I replace text in objects that are of class "formula"?
y="a * x + b"
class(y)="formula"
grep("x",y)
y[1]
Suppose I would like to replace the "x" by "w" in the formula object "y".
How can this be done? Somehow, the methods that can be used in character objects do not work 1:1 in
formula objects...
Many
2008 Oct 01
0
Minimizing both AIC and df in model selection
Dear R users,
Suppose I have a set of 10 candidate models, and these all differ by a delta-AIC of 5.
Would it be sensible, then, to choose the best-fit model as the one that has *both* minimal AIC
*and* minimal number of d.f.?
Are there any references for such an approach?
Many thanks for your help!
Best wishes,
Christoph
--
Dr. rer.nat. Christoph Scherber
University of Goettingen
DNPW,
2008 Feb 22
3
Simultaneously summarizing many models
Dear R users,
Let?s say I have 10 models, each named m1,m2,m3..., and I would like to summarize them automatically
and simultaneously - e.g., to extract parameter estimates later on from all models; how can I do that?
I have tried:
x=1:10 #this creates some example data
y=rnorm(10)
m1=lm(x~y)
m2=lm(x~1)
sum.lms=function(x)summary(paste("m",x,sep=""))
sum.lms(1:2)
but
2009 Aug 20
1
nested, repeated measure lme
Dear all,
Suppose I have a nested, repeated measure lme model. Which of the following formulae is correct?
(assuming data are sampled from several plots in an agricultural experiment)
(1) y~explanatory.variables,random=~time|block/plot/subplot/individual
(2) y~explanatory.variables,random=~time|unique.ID.of.every.individual
I have read that (2) is the only approach that works. But how could I
2008 Nov 03
2
standard errors for predict.nls?
Dear all,
Is there a way to retrieve standard errors from nls models? The help page tells me that arguments
such as se.fit are ignored...
Many thanks and best wishes
Christoph
--
Dr. rer.nat. Christoph Scherber
University of Goettingen
DNPW, Agroecology
Waldweg 26
D-37073 Goettingen
Germany
phone +49 (0)551 39 8807
fax +49 (0)551 39 8806
Homepage http://www.gwdg.de/~cscherb1
2009 Jan 07
1
Extracting degrees of freedom from a gnls object
Dear all,
How can I extract the total and residual d.f. from a gnls object?
I have tried str(summary(gnls.model)) and str(gnls.model) as well as gnls(), but couldn?t find the
entry in the resulting lists.
Many thanks!
Best wishes
Christoph
--
Dr. rer.nat. Christoph Scherber
University of Goettingen
DNPW, Agroecology
Waldweg 26
D-37073 Goettingen
Germany
phone +49 (0)551 39 8807
fax +49
2007 Nov 08
6
Extract correlations from a matrix
Dear R users,
suppose I have a matrix of observations for which I calculate all
pair-wise correlations:
m=matrix(sample(1:100,replace=T),10,10)
w=cor(m,use="pairwise.complete.obs")
How do I extract only those correlations that are >0.6?
w[w>0.6] #obviously doesn?t work,
and I can?t find a way around it.
I would very much appreciate any help!
Best wishes
Christoph
(using R
2008 Jun 07
1
Multivariate LM: calculating F-values after calling linear.hypothesis
Dear R users,
I am analyzing several response variables (all scaled to [0;1]) using a
multivariate linear model.
After fitting the model, I set up a hypothesis matrix to test specific
contrasts for these response variables; for example: "a always increases
significantly more than b when regressed against x".
What I am stuck with now is how to calculate the correct F-values (and
2008 Jul 24
2
What is wrong with this contrast matrix?
Dear all,
I am fitting a multivariate linear model with 7 response variables and 1 explanatory variable.
The following matrix P:
P <- cbind(
c(1,-1,0,0,0,0,0),
c(2,2,2,2,2,-5,-5),
c(1,0,0,-1,0,0,0),
c(-2,-2,0,-2,2,2,2),
c(-2,1,0,1,0,0,0),
c(0,-1,0,1,0,0,0))
should consist of orthogonal elements (as can be shown using %*% on the individual columns).
However, when I use
2011 Aug 19
1
Windows 7 issues with installing packages and setting library paths
Dear all,
I am forced to work in an environment without administrator rights.
When using R2.13.1 on Windows 7 (64-Bit), I found that I can?t install or update any packages due to missing writing permissions.
I managed to get full access to a directory on my C:\ drive now - but how do I specify that all libraries shall be installed into this directory?
In Rcmd_environ I have the following
2012 Jul 20
1
Creating a pdf with layers?
Dear all,
Is it possible to create a pdf file with layers using the pdf() device in R?
Many thanks for your help!
Christoph
(using R 2.15.1 on Windows 7 64-Bit)
--
PD Dr Christoph Scherber
Georg-August University Goettingen
Department of Crop Science
Agroecology
Grisebachstrasse 6
D-37077 Goettingen
Germany
phone 0049 (0)551 39 8807
fax 0049 (0)551 39 8806
http://www.gwdg.de/~cscherb1
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),
2010 Apr 01
2
Adding regression lines to each factor on a plot when using ANCOVA
Dear R users,
i'm using a custom function to fit ancova models to a dataset. The data are
divided into 12 groups, with one dependent variable and one covariate. When
plotting the data, i'd like to add separate regression lines for each group
(so, 12 lines, each with their respective individual slopes). My 'model1'
uses the group*covariate interaction term, and so the coefficients
2011 Sep 08
1
predict.rma (metafor package)
Hi
(R 2.13.1, OSX 10.6.8)
I am trying to use predict.rma with continuous and categorical variables. The argument newmods in predict.rma seems to handle coviariates, but appears to falter on factors. While I realise that the coefficients for factors provide the answers, the goal is to eventually use predict.rma with ANCOVA type model with an interaction.
Here is a self contained example
2011 Apr 14
1
mixed model random interaction term log likelihood ratio test
Hello,
I am using the following model
model1=lmer(PairFrequency~MatingPair+(1|DrugPair)+(1|DrugPair:MatingPair),
data=MateChoice, REML=F)
1. After reading around through the R help, I have learned that the above
code is the right way to analyze a mixed model with the MatingPair as the
fixed effect, DrugPair as the random effect and the interaction between
these two as the random effect as well.
2009 Mar 09
1
lme anova() and model simplification
I am running an lme model with the main effects of four fixed variables (3
continuous and one categorical – see below) and one random variable. The
data describe the densities of a mite species – awsm – in relation to four
variables: adh31 (temperature related), apsm (another plant feeding mite)
awpm (a predatory mite), and orien (sampling location within plant – north
or south).
I have read
2004 Oct 26
3
GLM model vs. GAM model
I have a question about how to compare a GLM with a GAM model using anova
function.
A GLM is performed for example:
model1 <-glm(formula = exitus ~ age+gender+diabetes, family = "binomial",
na.action = na.exclude)
A second nested model could be:
model2 <-glm(formula = exitus ~ age+gender, family = "binomial", na.action =
na.exclude)
To compare these two GLM
2012 Mar 20
2
anova.lm F test confusion
I am using anova.lm to compare 3 linear models. Model 1 has 1 variable,
model 2 has 2 variables and model 3 has 3 variables. All models are fitted
to the same data set.
anova.lm(model1,model2) gives me:
Res.Df RSS Df Sum of Sq F Pr(>F)
1 135 245.38
2 134 184.36 1 61.022 44.354 6.467e-10 ***
anova.lm(model1,model2,model3) gives
2010 Feb 09
1
Missing interaction effect in binomial GLMM with lmer
Dear all,
I was wondering if anyone could help solve a problem of a missing interaction effect!!
I carried out a 2 x 2 factorial experiment to see if eggs from 2 different locations (Origin = 1 or 2) had different hatching success under 2 different incubation schedules (Treat = 1 or 2). Six eggs were taken from 10 females (random = Female) at each location and split between the treatments,