Displaying 16 results from an estimated 16 matches for "mod0".
Did you mean:
mod
2006 Apr 01
1
Nested error structure in nonlinear model
...8)
OK, I can do this using nls() - but "only just" as there are not as many
observations as might be desired.
Now the problem is that we have a factor "Site" and I want to include a
corresponding error component. I tried something like (excuse the
doctored R output):
> mod0.nlme <- nlme(Y ~ Yhat(theta1,...,theta8) + site.err ,
+ start = c(mod0.st,0),
+ groups = ~ Site,
+ fixed = theta1 + ... + theta8 ~ 1,
+ random = site.err ~ 1)
Error in nlme.formula(Y ~ Yhat(theta1,...,theta8 :
s...
2010 Apr 13
2
Generating model formulas for all k-way terms
...models <- list()
mod <- glm(formula, family, data, ...)
terms <- terms(formula)
tl <- attr(terms, "term.labels")
nt <- length(tl)
models[[1]] <- mod
for(i in 2:order) {
models[[i]] <- update(mod, .~.^i)
}
# null model
mod0 <- update(mod, .~1)
models <- c(mod0, models)
class(models) <- "glmlist"
models
}
> mods <- Kway(Freq ~ A + B + C, data=df, family=poisson)
Error in terms.formula(tmp, simplify = TRUE) : invalid power in formula
I still don't understand how to manipula...
2007 Jan 17
1
Coefficient of determination when intercept is zero
I am curious as to the "lm" calculation of R2 (multiple coefficient of
determination, I assume) when intercept is zero. I have 18 data points, two
independent variables:
First, a model with an intercept:
> mod0=lm(Div~Rain+Evap,data=test)
> summary(mod0)$r.squared
[1] 0.6257541
> cor(predict(mod0),test$Div)^2
[1] 0.6257541
The $r.squared and the result from "cor" are the same, as I would expect.
Now we try a model with zero intercept:
> mod1=lm(Div~0+Rain+Evap,data=test)
> summary...
2013 Nov 25
4
lmer specification for random effects: contradictory reults
...avidsonB
ates.pdf&ei=FhqTUoXuJKKV7Abds4GYBA&usg=AFQjCNFst7GT7mBX7w9lXItJTtELJSKWJg&si
g2=KGA5MHxOvEGwDxf-Gcqi6g&bvm> R.H. et al 2008)
Here, dT_purs is the response variable, T and Z are the fixed effects, and
subject is the random effect. Random and fixed effects are crossed.:
mod0 <- lmer(dT_purs ~ T + Z + (1|subject), data = x)
mod1 <- lmer(dT_purs ~ T + Z + (1 +tempo| subject), data = x)
mod2 <- lmer(dT_purs ~ T + Z + (1 +tempo| subject) + (1+ Z| subject), data =
x)
mod3 <- lmer(dT_purs ~ T * Z + (1 +tempo| subject) + (1+ Z| subject), data =
x)
mod4 <- lmer...
2012 Jan 10
1
importing S3 methods with importFrom
...pplicable method for 'lrtest' applied to an object of class
"c('glm', 'lm')"
Calls: assocTestRegression ... append -> RunRegression -> append ->
unlist -> lrtest
Relevant line of code in assocTestRegression is
tmp <- append(tmp, unlist(lrtest(mod, mod0))[c(8,10)])
where mod and mod0 are both results of the glm() function.
If I instead import the entire package in my NAMESPACE:
import(lmtest)
The example runs without error. Is there a way to import all methods
for an S3 generic function without importing the entire package?
thanks,
Stephanie...
2007 Dec 24
1
curve fitting problem
I'm trying to fit a function y=k*l^(m*x) to some data points, with reasonable starting value estimates (I think). I keep getting "singular matrix 'a' in solve".
This is the code:
ox <- c(-600,-300,-200,1,100,200)
ir <- c(1,2.5,4,9,14,20)
model <- nls(ir ~ k*l^(m*ox),start=list(k=10,l=3,m=0.004),algorithm="plinear")
summary(model)
plot(ox,ir)
testox <-
2011 Jan 06
4
Different LLRs on multinomial logit models in R and SPSS
...ata.frame(
"y"=factor(sample(LETTERS[1:3], 143, repl=T, prob=c(4, 1, 10))),
"a"=sample(1:5, 143, repl=T),
"b"=sample(1:7, 143, repl=T),
"c"=sample(1:2, 143, repl=T)
)
library(nnet)
mod1 <- multinom(y ~ ., data=df, trace=F)
deviance(mod1) # 199.0659
mod0 <- update(mod1, . ~ 1, trace=FALSE)
deviance(mod0) # 204.2904
Output data and syntax for SPSS:
df2 <- df
df2[, 1] <- as.numeric(df[, 1])
write.csv(df2, file="dfxy.csv", row.names=F, na="")
syntaxfile <- "dfxy.sps"
cat('GET DATA
/TYPE=TXT
/FILE=\...
2013 Nov 25
0
R: lmer specification for random effects: contradictory reults
...DavidsonB
ates.pdf&ei=FhqTUoXuJKKV7Abds4GYBA&usg=AFQjCNFst7GT7mBX7w9lXItJTtELJSKWJg&si
g2=KGA5MHxOvEGwDxf-Gcqi6g&bvm> R.H. et al 2008) Here, dT_purs is the
response variable, T and Z are the fixed effects, and subject is the random
effect. Random and fixed effects are crossed.:
mod0 <- lmer(dT_purs ~ T + Z + (1|subject), data = x)
mod1 <- lmer(dT_purs ~ T + Z + (1 +tempo| subject), data = x)
mod2 <- lmer(dT_purs ~ T + Z + (1 +tempo| subject) + (1+ Z| subject), data =
x)
mod3 <- lmer(dT_purs ~ T * Z + (1 +tempo| subject) + (1+ Z| subject), data =
x)
mod4 <- lmer(...
2010 Feb 28
1
trend test for frequencies
Hi,
which test do I have to use if I want to test if the following data follow a monotone trend;
0min 5min 10min 20min 30min
5 20 55 70 90
... where the dependent variable contains frequencies.
And how is that implemented in R?
thanks for any help (on this more statistical-question ...).
2010 Mar 01
0
MASS::loglm - exploring a collection of models with add1, drop1
...;Female"
- attr(*, "class")= chr [1:2] "xtabs" "table"
- attr(*, "call")= language xtabs(formula = as.formula(paste("freq ~",
paste(tvars, collapse = "+"))), data = table)
# fit baseline log-linear model for Status as response
hoyt.mod0 <- loglm(~ Status + (Sex*Rank*Occupation), data=Hoyt1)
> (hoyt.add1 <- add1(hoyt.mod0, ~.^2, test="Chisq"))
Single term additions
Model:
~Status + (Sex * Rank * Occupation)
Df AIC LRT Pr(Chi)
<none> 2166.36
Status:Sex 1 2129.54 38.82 4.658e-10 ***
Status:Rank 2 1430.03 7...
2007 Sep 19
1
lmer using quasibinomial family
...a simulated dataset (with anova tests at the
end):
library(lme4)
Y1<-sample(c(rbinom(90,10,0.1),rbinom(90,10,0.7)))
Y2<-10-Y1
Y<-cbind(Y1,Y2)
Group<-c(rep("A",80),rep("B",50),rep("C",50))
Group<-as.factor(sample(Group))
X<-Y1*rnorm(180,mean=0,sd=10)
mod0<-lmer(Y~X+(1|Group),family=binomial) #model using binomial family
summary(mod0)
Generalized linear mixed model fit using Laplace
Formula: Y ~ X + (1 | Group)
Family: binomial(logit link)
AIC BIC logLik deviance
872.9 882.4 -433.4 866.9
Random effects:
Groups Name Variance Std.Dev.
Group (Interc...
2006 Jan 10
2
Obtaining the adjusted r-square given the regression coefficients
Hi people,
I want to obtain the adjusted r-square given a set of coefficients (without the intercept), and I don't know if there is a function that does it. Exist????????????????
I know that if you make a linear regression, you enter the dataset and have in "summary" the adjusted r-square. But this is calculated using the coefficients that R obtained,and I want other coefficients
2010 Sep 08
4
coxph and ordinal variables?
Dear R-help members,
Apologies - I am posting on behalf of a colleague, who is a little puzzled
as STATA and R seem to be yielding different survival estimates for the same
dataset when treating a variable as ordinal. Ordered() is used to represent
an ordinal variable) I understand that R's coxph (by default) uses the Efron
approximation, whereas STATA uses (by default) the Breslow. but we
2013 Sep 12
6
declaring package dependencies
...http://cran.r-project.org/web/checks/check_results_vcdExtra.html
But, I can't see what to do to avoid this, nor understand what has
changed in R devel.
Sure enough, CRAN now reports errors in examples using MASS::loglm(),
using R Under development (unstable) (2013-09-11 r63906)
> Caesar.mod0 <- loglm(~Infection + (Risk*Antibiotics*Planned),
data=Caesar)
Error: could not find function "loglm"
In DESCRIPTION I have
Depends: R (>= 2.10), vcd, gnm (>= 1.0.3)
Suggests:
ca,gmodels,Fahrmeir,effects,VGAM,plyr,rgl,lmtest,MASS,nnet,ggplot2,Sleuth2,car
and the vcd DESCRIPTI...
2009 Aug 13
2
glm.nb versus glm estimation of theta.
Hello,
I have a question regarding estimation of the dispersion parameter (theta)
for generalized linear models with the negative binomial error structure. As
I understand, there are two main methods to fit glm's using the nb error
structure in R: glm.nb() or glm() with the negative.binomial(theta) family.
Both functions are implemented through the MASS library. Fitting the model
using these
2009 Sep 11
3
For sending my R package as part of R-project
...r R list,
>
> is it possible to force the intercept to assume the value of 0 (that is no
> intercept) in gam from gam package?
Just like you would in lm or glm for example, by adding -1 to your
formula. ?gam suggests you look at ?lm to see about the formulas for
example.
data(airquality)
mod0 <- gam(Ozone^(1/3) ~ lo(Solar.R) + lo(Wind, Temp) - 1,
data = airquality, na = na.gam.replace)
mod1 <- gam(Ozone^(1/3) ~ lo(Solar.R) + lo(Wind, Temp),
data = airquality, na = na.gam.replace)
summary(mod0)
summary(mod1)
HTH
G
>
> Regards
--
%~%~%~%~%~%~%~%~%~%...