Displaying 20 results from an estimated 75 matches for "fit3".
Did you mean:
fit
2013 Apr 09
2
R crash
...;- REL
library(pseudo)
pseudo <- pseudoci(time=a$TIME,event=a$icr,tmax=cutoffs)
#rearranging data
b <- NULL
for(it in 1:length(pseudo$time)){
b <- rbind(b,cbind(a,pseudo = pseudo$pseudo[[1]][,it],
tpseudo = pseudo$time[it],id=1:nrow(a)))
}
b <- b[order(b$id),]
library(geepack)
fit3 <- geese(pseudo ~ as.factor(AGE) + as.factor(WEIGHT) +
as.factor(HEIGHT) ,
data =b, id=id, jack = TRUE, scale.fix=TRUE,
mean.link = "logit", corstr="unstructured")
#The results using the AJ variance estimate
cbind(mean = round(fit3$beta,4), SD = round(sqrt(diag(fit3$vbeta.a...
2009 Mar 26
0
(Interpretation) VGAM - FRECHET 3 parameters by maximum likelihood estimation for
Dear R Helpers
This is the R code (which I have slightly changed) I got in VGAM package for estimating the parameters of FRECHET.
_________________________________________________________________
y = rfrechet(n <- 100, shape=exp(exp(0))) # (A)
fit3 = vglm(y ~ 1, frechet3(ilocation=0), trace=TRUE, maxit=155) # (B)
coef(fit3, matrix=TRUE) # (C)
Coef(fit3) # (D)
fitted(fit3)[1:5,] # (E)
mean(y)...
2009 Jul 28
2
A hiccup when using anova on gam() fits.
I stumbled across a mild glitch when trying to compare the
result of gam() fitting with the result of lm() fitting.
The following code demonstrates the problem:
library(gam)
x <- rep(1:10,10)
set.seed(42)
y <- rnorm(100)
fit1 <- lm(y~x)
fit2 <- gam(y~lo(x))
fit3 <- lm(y~factor(x))
print(anova(fit1,fit2)) # No worries.
print(anova(fit1,fit3)) # Likewise.
print(anova(fit2,fit3)) # Throws an error.
print(anova(fit3,fit2)) # ``Works'' but gives negative degrees of
freedom and sum of squares.
Is this evidence of a ``bug''? Or am I being t...
2009 May 12
1
questions on rpart (tree changes when rearrange the order of covariates?!)
...ot;CART for original data")
text(fit2,use.n=T,cex=0.6)
printcp(fit2)
table(predict(fit2,type="class"),mydata$diabetes)
## misclassifcation table: rows are fitted class
neg pos
neg 437 68
pos 63 200
#Klimt(fit2,mydata)
pmydata<-data.frame(mydata[,c(1,6,3,4,5,2,7,8,9)])
fit3<-rpart(diabetes~., data=pmydata,method="class")
plot(fit3,uniform=T,main="CART after exchaging mass & glucose")
text(fit3,use.n=T,cex=0.6)
printcp(fit3)
table(predict(fit3,type="class"),pmydata$diabetes)
##after exchage the order of BODY mass and PLASMA glucose...
2012 Nov 08
2
Comparing nonlinear, non-nested models
...ym, k) ym * (x-xo)/(k+x-xo)
model3 <- function(x, xo, ym) ym * (1-exp(-log(2)*(x-xo)/xo))
model4 <- function(x, xo, ym, k) ym * (1-exp(-log(2)*(x-xo)/k))
fit1 <- nls(y~model1(x, xo, ym), start=list(xo=0.5, ym=1))
fit2 <- nls(y~model2(x, xo, ym, k), start=list(xo=0.5, ym=1, k=1))
fit3 <- nls(y~model3(x, xo, ym), start=list(xo=0.5, ym=1))
fit4 <- nls(y~model4(x, xo, ym, k), start=list(xo=0.5, ym=1, k=1))
anova(fit1, fit2)
anova(fit3, fit4)
Models 1 and 2 are nested, as are models 3 and 4 (set k=xo), so they can be
compared using anova. I am looking for a way to compare...
2005 Apr 23
1
question about about the drop1
...ot;Yes","No"),levels=c("No","Yes")), cigarette=factor(c("Yes","No"),levels=c("No","Yes")), alcohol=factor(c("Yes","No"),levels=c("No","Yes"))), count=c(911,538,44,456,3,43,2,279))
>fit3<-glm(count~.^3,poisson,table.8.3)
>sumary(fit3)
...
Residual deviance: -1.5543e-15 on 0 degrees of freedom
AIC: 65.043
> drop1(fit3,.~.,test="Chisq")
Single term deletions
Model:
count ~ (marijuana + cigarette + alcohol)^3
Df Deviance AIC L...
2009 May 22
1
bug in rpart?
...,uniform=T,main="CART for original data")
text(fit2,use.n=T,cex=0.6)
printcp(fit2)
table(predict(fit2,type="class"),mydata$diabetes)
## misclassifcation table: rows are fitted class
neg pos
neg 437 68
pos 63 200
pmydata<-data.frame(mydata[,c(1,6,3,4,5,2,7,8,9)])
fit3<-rpart(diabetes~., data=pmydata,method="class")
plot(fit3,uniform=T,main="CART after exchaging mass & glucose")
text(fit3,use.n=T,cex=0.6)
printcp(fit3)
table(predict(fit3,type="class"),pmydata$diabetes)
##after exchage the order of BODY mass and PLASMA glucose...
2011 Sep 12
1
coxreg vs coxph: time-dependent treatment
...e-weights
fit1 <- coxreg(Surv(start,stop,event)~transplant, data=heart)
fit1 # fit with coxreg from eha without case-weights
# coxph
fit2 <- coxph(Surv(start,stop,event)~transplant + cluster(id),
data=heart, weights = iptw, robust = T)
fit2 # fit with coxph having robust and cluster option
fit3 <- coxph(Surv(start,stop,event)~transplant + cluster(id),
data=heart, weights = iptw)
fit3 # fit with coxph having cluster option
fit4 <- coxph(Surv(start,stop,event)~transplant,
data=heart, weights = iptw)
fit4 # fit with coxph
# coxreg
fit5 <- coxreg(Surv(start,stop,event)~transplan...
2004 Dec 20
2
problems with limma
...M t P.Value B
88 1426.738 80.48058 5.839462e-05 -4.510845
1964 36774.167 73.05580 5.839462e-05 -4.510861
5854 7422.578 68.60316 5.839462e-05 -4.510874
11890 1975.316 66.54480 5.839462e-05 -4.510880
9088 2696.952 64.16343 5.839462e-05 -4.510889
> #
> fit3 <- lmFit(bas,design)
> fit3 <- eBayes(fit3)
> topTable(fit3,adjust="fdr",number=5)
M t P.Value B
6262 1415.088 100.78933 2.109822e-05 -4.521016
5660 1913.479 96.40903 2.109822e-05 -4.521020
11900 4458.489 94.30738 2.109822e-05 -4.521022...
2018 Jan 17
1
Assessing calibration of Cox model with time-dependent coefficients
...uot;expected")) lp <- predict(fit0,
newdata = data1, type = "lp") logbase <- p - lp fit1 <- glm(y ~ offset(p),
family = poisson, data = data1) fit2 <- glm(y ~ lp + offset(logbase),
family = poisson, data = data1) group <- cut(lp, c(-Inf, quantile(lp, (1:9)
/ 10), Inf)) fit3 <- glm(y ~ -1 + group + offset(p), family = poisson, data
= data1)
Here?I simplely use data1 <- data0[1:500,]
First, I get following error when running line 5.
Error in eval(predvars, data, env) : object 'y' not found
So I modifited the code by replacing the y as status looks like...
2005 Jun 15
1
anova.lme error
...6)
)
## This leads to the following error:
## Error in anova.lme(object = fit1, fit2) : Object "fit2" not found
results <- myFunction(myDataFrame=df)
#####################################################
## The same thing outside of a function
# Less restricted
fit3 <- gls(y ~ dose,
weights=varIdent(form=~1|dose),
data=df)
# more restricted
fit4 <- gls(y ~ dose,
data=df)
## This works:
anova(fit3, fit4)
## The results:
## > anova(fit3, fit4)
## Model df AIC BIC logLik Test L.Ratio p-value...
2010 Jul 31
2
Is profile.mle flexible enough?
...n(mu) { logsigma2 <- 0;
N*log(2*pi*exp(logsigma2))/2 +
N*(var(x)+(mean(x)-mu)^2)/(2*exp(logsigma2)) }
N <- 100
x <- rnorm(N, 0, 1)
fit <- mle(minusLogL1, start=list(mu=0, logsigma2=0))
confint(fit)
fit2 <- mle(minusLogL1, start=list(mu=0), fixed=list(logsigma2=0))
confint(fit2)
fit3 <- mle(minusLogL2, start=list(mu=0))
confint(fit3)
----------->8--------------------------------
Is it unreasonable to expect an identical result with fit2 and fit3?
When looking into the code of the "profile" method for mle, one can find
something like call$fixed <- fix ; i.e...
2008 Jan 05
1
Likelihood ratio test for proportional odds logistic regression
...ull polr model (refer to example below)? So in the
case of the example below, the p-value would be 1.
2. For the model in which there is only one independent variable, I
would expect the Wald test and the likelihood ratio test to give
similar p-values. However the p-values obtained from anova(fit1,fit3)
(refer to example below) are very different (0.0002622986 vs. 1). Why
is this so?
> library(MASS)
> fit1 <- polr(housing$Sat~1)
> fit2<- polr(housing$Sat~housing$Infl)
> fit3<- polr(housing$Sat~housing$Cont)
> summary(fit1)
Re-fitting to get Hessian
Call:
polr(formula =...
2008 Apr 17
1
survreg() with frailty
...or Windows
library(survival) # version 2.34-1 (2008-03-31)
# discrepancy
fit1 <- survreg(Surv(time, status) ~ rx + frailty(litter), rats)
fit1
fit1$history[[1]]$theta
# OK
fit2 <- survreg(Surv(time, status) ~ rx + frailty(litter, df = 13),
rats)
fit2
fit2$history[[1]]$theta
# discrepancy
fit3 <- survreg(Surv(time, status)~ age + sex + frailty(id), kidney)
fit3
fit3$history[[1]]$theta
# OK
fit4 <- survreg(Surv(time, status)~ age + frailty(id), kidney)
fit4
fit4$history[[1]]$theta
Am I missing something? Thanks in advance for any pointers!
Best,
Dimitris
----
Dimitris Rizopoulo...
2010 Feb 26
2
Error in mvpart example
Dear all,
I'm getting an error in one of the stock examples in the 'mvpart' package. I tried:
require(mvpart)
data(spider)
fit3 <- rpart(gdist(spider[,1:12],meth="bray",full=TRUE,sq=TRUE)~water+twigs+reft+herbs+moss+sand,spider,method="dist") #directly from ?rpart
summary(fit3)
...which returned the following:
Error in apply(formatg(yval, digits - 3), 1, paste, collapse = ",", sep = "...
2009 Apr 24
2
prediction intervals (alpha and beta) for model average estimates from binomial glm and model.avg (library=dRedging)
...(y~á+âx). The model average estimates are from the dRedging library?
It seems a common thing but I can't seem to find one via the search engines
Examples of the models are:
fit1 <- glm(y~ dbh, family = binomial, data = data)
fit2 <- glm(y~ dbh+vegperc, family = binomial, data = data)
fit3 <- glm(y~ dbh, family = binomial, data = data)
and the model averaging
model.averaging <-model.avg(fit1,fit2,fit3, method="0")
and the output (from model.avg) has the following items: Coefficient, Variance, Standard error, adjusted standard error and lower and upper confidence i...
2009 Apr 28
1
How to read the summary
How can I from the summary function, decide which glm (fit1, fit2 or fit3)
fits to data best? I don't know what to look after, so I would please
explain the important output.
> fit1 <- glm(Y~X, family=gaussian(link="identity"))
> fit2 <- glm(Y~X, family=gaussian(link="log"))
> fit3 <- glm(Y~X, family=Gamma(link="log"))...
2011 Jan 05
1
Comparing fitting models
...not.
From the R prompt I am not able to see where I can get this information.
Let´s do an example:
fit1<- lm(response ~ stimulus + condition + stimulus:condition, data=scrd)
#EQUIVALE A lm(response ~ stimulus*condition, data=scrd)
fit2<- lm(response ~ stimulus + condition, data=scrd)
fit3<- lm(response ~ condition, data=scrd)
> anova(fit2, fit1) #compare models
Analysis of Variance Table
Model 1: response ~ stimulus + condition
Model 2: response ~ stimulus + condition + stimulus:condition
Res.Df RSS Df Sum of Sq F Pr(>F)
1 165 364.13...
2005 Aug 29
1
Different sings for correlations in OLS and TSA
...uld be consistent with following processes:
fun.tsa.mle(ts.mar) #following DAAG a p=2 AR
fun.tsa.mle(ts.anr) #following DAAG a p=2 AR
#I need to know, wether ts.anr can be explained with ts.mar, so
#according to ar.mle:
mod3<-arima(ts.anr,order=c(2,0,0),xreg=ts.mar,transform.pars=TRUE)
fit3 <- gls(ts.anr ~ ts.mar,correlation =
corARMA(value=c(mod3$coef[1],mod3$coef[2]),p=2))
summary(fit3)
ts.plot(ts.anr,fit3$fitted,col=1:2)
#the puzzling bit is the negative correlation. It ought to be positive,
I think.
#a simple OLS (this is what the people before me have done) yields
test3<-...
2018 Jan 18
1
Time-dependent coefficients in a Cox model with categorical variants
...<- predict(fit0, newdata = data1, type = "lp")
4. logbase <- p - lp
5. fit1 <- glm(status ~ offset(p), family = poisson, data = data1)
6. fit2 <- glm(status~ lp + offset(logbase), family = poisson, data = data1)
7. group <- cut(lp, c(-Inf, quantile(lp, (1:9) / 10), Inf))
8. fit3 <- glm(status ~ -1 + group + offset(p), family = poisson, data = data1)
The key idea of the paper you referenced is that the counterpart to the Hosmer-Lemishow test (wrong if used directly in a Cox model) is to look at the predicted values from a Cox model as input to a Poisson regression. Tha...