similar to: problem with logLik and offsets

Displaying 20 results from an estimated 4000 matches similar to: "problem with logLik and offsets"

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
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
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.
2010 Oct 03
5
How to iterate through different arguments?
If I have a model line = lm(y~x1) and I want to use a for loop to change the number of explanatory variables, how would I do this? So for example I want to store the model objects in a list. model1 = lm(y~x1) model2 = lm(y~x1+x2) model3 = lm(y~x1+x2+x3) model4 = lm(y~x1+x2+x3+x4) model5 = lm(y~x1+x2+x3+x4+x5)... model10. model_function = function(x){ for(i in 1:x) { } If x =1, then the list
2005 Jul 15
1
nlme and spatially correlated errors
Dear R users, I am using lme and nlme to account for spatially correlated errors as random effects. My basic question is about being able to correct F, p, R2 and parameters of models that do not take into account the nature of such errors using gls, glm or nlm and replace them for new F, p, R2 and parameters using lme and nlme as random effects. I am studying distribution patterns of 50 tree
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
2008 Oct 02
1
An AIC model selection question
Dear R users, Assume I have three models with the following AIC values: model AIC df model1 -10 2 model2 -12 5 model3 -11 2 Obviously, model2 would be preferred, but it "wastes" 5 df compared to the other models. Would it be allowed to select model3 instead, simply because it uses up less df and the delta-AIC between model2 and model3 is just 1? Many thanks for any
2012 Jun 06
3
Sobel's test for mediation and lme4/nlme
Hello, Any advice or pointers for implementing Sobel's test for mediation in 2-level model setting? For fitting the hierarchical models, I am using "lme4" but could also revert to "nlme" since it is a relatively simple varying intercept model and they yield identical estimates. I apologize for this is an R question with an embedded statistical question. I noticed that a
2006 Sep 12
4
variables in object names
Is there any way to put an argument into an object name. For example, say I have 5 objects, model1, model2, model3, model4 and model5. I would like to make a vector of the r.squares from each model by code such as this: rsq <- summary(model1)$r.squared for(i in 2:5){ rsq <- c(rsq, summary(model%i%)$r.squared) } So I assign the first value to rsq then cycle through models 2 through
2017 Jul 07
1
Scoring and Ranking Methods
Hi, I am doing predictive modelling of Multivariate Time series Data of a Motor in R using various models such as Arima, H2O.Randomforest, glmnet, lm and few other models. I created a function to select a model of our choice and do prediction. Model1 <- function(){ .. return() } Model2 <- function(){ ... return() } Model3 <- function(){ ... return() } main <-
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
2009 Dec 10
1
updating arguments of formulae
Dear R-Community, I am relatively new with R, so sorry for things which for you might be obvious... I am trying to automatically update lmer formulae. the variables of the model are: depM= my dependent measure Sb2= a random factor OS = a predictor VR= another predictor So, I am building the first model with random intercept only: model = lmer(depM ~ (1 |Sb2)) then I update the formula
2012 Nov 08
2
Comparing nonlinear, non-nested models
Dear R users, Could somebody please help me to find a way of comparing nonlinear, non-nested models in R, where the number of parameters is not necessarily different? Here is a sample (growth rates, y, as a function of internal substrate concentration, x): x <- c(0.52, 1.21, 1.45, 1.64, 1.89, 2.14, 2.47, 3.20, 4.47, 5.31, 6.48) y <- c(0.00, 0.35, 0.41, 0.49, 0.58, 0.61, 0.71, 0.83, 0.98,
2010 Jul 14
1
question about SVM in e1071
Hi, I have a question about the parameter C (cost) in svm function in e1071. I thought larger C is prone to overfitting than smaller C, and hence leads to more support vectors. However, using the Wisconsin breast cancer example on the link: http://planatscher.net/svmtut/svmtut.html I found that the largest cost have fewest support vectors, which is contrary to what I think. please see the scripts
2006 Apr 25
1
lme: how to compare random effects in two subsets of data
Dear R-gurus, I have an interpretation problem regarding lme models. I am currently working on dog locomotion, particularly on some variation factors. I try to figure out which limb out of 2 generated more dispersed data. I record a value called Peak, around 20 times for each limb with a record. I repeat the records during a single day, and on several days. I tried to build two models, one
2006 Sep 20
5
acts_as_ferret limit on multi_search not working?
I''m using acts_as_ferret to do a query like this: Model1.multi_search("my query",[Model2,Model3], :limit => 2) No matter what number i set limit to I get 10 items in the resultset. Am I doing something wrong? Thanks/David -- Posted via http://www.ruby-forum.com/.
2006 Aug 30
1
lmer applied to a wellknown (?) example
Dear all, During my pre-R era I tried (yes, tried) to understand mixed models by working through the 'rat example' in Sokal and Rohlfs Biometry (2000) 3ed p 288-292. The same example was later used by Crawley (2002) in his Statistical Computing p 363-373 and I have seen the same data being used elsewhere in the litterature. Because this example is so thoroughly described, I thought
2007 Aug 14
1
glm(family=binomial) and lmer
Dear R users, I've notice that there are two ways to conduct a binomial GLM with binomial counts using R. The first way is outlined by Michael Crawley in his "Statistical Computing book" (p 520-521): >dose=c(1,3,10,30,100) >dead = c(2,10,40,96,98) >batch=c(100,90,98,100,100) >response = cbind(dead,batch-dead) >model1=glm(y~log(dose),binomial)
2009 Mar 31
1
using "substitute" inside a legend
Hello list, I have a linear regression: mylm = lm(y~x-1) I've been reading old mail postings as well as the plotmath demo and I came up with a way to print an equation resulting from a linear regression: model = substitute(list("y"==slope%*%"x", R^2==rsq), list(slope=round(mylm$coefficients[[1]],2),rsq=round(summary(mylm)$adj.r.squared, 2))) I have four models and I