Displaying 20 results from an estimated 7000 matches similar to: "How does predict() calculate prediction intervals?"
2009 Mar 12
3
help with predict and plotting confidence intervals
Dear R help,
This seems to be a commonly asked question and I am able to run examples that have been proposed, but I can't seems to get this to work with my own data. Reproducible code is below. Thank you in advance for any help you can provide.
The main problem is that I can not get the confidence lines to plot correctly.
The secondary problem is that predict is not able to find my object
2010 Jul 27
1
problem with zero-weighted observations in predict.lm?
In modelling functions some people like to use
a weight of 0 to drop an observation instead of
using a subset value of FALSE. E.g.,
weights=c(0,1,1,...)
instead of
subset=c(FALSE, TRUE, TRUE, ...)
to drop the first observation.
lm() and summary.lm() appear to treat these in the
same way, decrementing the number of degrees of
freedom for each dropped observation. However,
predict.lm() does
2008 Nov 19
2
ggplot2; dot plot, jitter, and error bars
With this data
x <- c(0,0,1,1,2,2)
y <- c(5,6,4,3,2,6)
lwr <- y-1
upr <- y+1
xlab <- c("Low","Low","Med","Med","High","High")
mydata <- data.frame(x,xlab,y,lwr,upr)
I would like to make a dot plot and use lwr and upr as error bars.
Above 0=Low. I would like there to be
some space between the 5 and the 6 corresponding
2009 Sep 04
1
predicting from segmented regression
Hello
I'm having trouble figuring out how to use the output of "segmented()"
with a new set of predictor values.
Using the example of the help file:
??set.seed(12)
xx<-1:100
zz<-runif(100)
yy<-2+1.5*pmax(xx-35,0)-1.5*pmax(xx-70,0)+15*pmax(zz-.5,0)+rnorm(100,0,2)
dati<-data.frame(x=xx,y=yy,z=zz)
out.lm<-lm(y~x,data=dati)
o<-## S3
2010 Jan 11
1
HoltWinters Forecasting
Hi R-users,
I have a question relating to the HoltWinters() function. I am trying to
forecast a series using the Holt Winters methodology but I am getting some
unusual results. I had previously been using R for Windows version 2.7.2 and
have just started using R 2.9.1. While using version 2.7.2 I was getting
reasonable results however upon changing versions I found I started to see
unusual
2006 Sep 15
2
prediction interval for new value
Hi,
1. How do I construct 95% prediction interval for new x values, for example - x = 30000?
2. How do I construct 95% confidence interval?
my dataframe is as follows :
>dt
structure(list(y = c(26100000,
60500000, 16200000, 30700000, 70100000, 57700000, 46700000, 8600000,
10000000, 61800000, 30200000, 52200000, 71900000, 55000000, 12700000
), x = c(108000, 136000,
2012 Oct 08
6
How to use Lines function to draw the error bars?
fit lwr upr
1 218.4332 90.51019 346.3561
2 218.3906 90.46133 346.3198
3 218.3906 90.46133 346.3198
4 161.3982 44.85702 277.9394
5 192.4450 68.39903 316.4909
6 179.8056 56.49540 303.1158
7 219.5406 91.52707 347.5542
8 162.6761 46.65760 278.6945
9 193.8506 70.59838 317.1029
10 181.3816 58.11305 304.6502
11 221.2871 92.14366 350.4305
12 164.2947 47.91081 280.6785
13
2006 Nov 28
1
Slight discrepancy between predict.lm() and all.effects()
In the course of exploring response prediction, I stumbled upon a
small discrepancy between the CIs produced by predict.lm() and
all.effects()
require(mlmRev)
require(effects)
hsb.lm <- lm(mAch ~ minrty * sector, Hsb82)
hsb.new <- data.frame(
minrty = rep(c('No', 'Yes'), 2),
sector = rep(c('Public', 'Catholic'), each = 2))
hsb.eff <-
2001 Apr 09
5
predict problem
Windows 98
R : Copyright 2001, The R Development Core Team
Version 1.2.1 (2001-01-15)
Dear friends.
How comes this works and produce a single prediction:
x <- rnorm(15)
y <- x + rnorm(15)
predict(lm(y ~ x))
new <- data.frame(x = seq(-3, 3, 0.5))
predict(lm(y ~ x), new, se.fit = TRUE)
pred.w.plim <- predict(lm(y ~ x), new, interval="confidence")
new1 <- data.frame(x=3)
2010 Apr 29
1
R Anova Analysis
Dear all,
I have a quite basic questions about anova analysis in R, sorry for
this, but I have no clue how to explain this result.
I have two datasets which are named: nmda123, nmda456. Each dataset has
three samples which were measured three times. And I would like to
compare means of them with Posthoc test using R, following please see
the output:
(CREB, mCREB and No virus are the name of
2011 Mar 23
1
what's interesting to plot after predict.lm?
Dear all,
I've fitted this model with train data
lms <- lm(vd ~ log(v1) + fv2+ fv5+ fv7 )
and predicted over test data using
plms <- predict.lm(lmsub, new=test,interval="predict",
level=0.95,se.fit=TRUE)
I've two questions:
q1: what's the difference between writing interval "predict" or "confidence"
? How are they computed?
Any
2017 Jun 12
2
plotting gamm results in lattice
Dear all,?
I hope that you can help me on this. I have been struggling to figure this out but I haven't found any solution.
I am running a generalised mixed effect model, gamm4, for an ecology project. Below is the code for the model:
model<-gamm4(LIFE.OE_spring~s(Q95, by=super.end.group)+Year+Hms_Rsctned+Hms_Poaching+X.broadleaved_woodland? ? ? ? ? ? ?+X.urban.suburban+X.CapWks,
2013 May 17
2
zigzag confidence interval in a plot
Dear All,
When I plot the values and linear regression line for one data set, it is fine. But for another one I see zigzags, when I plot the confidence interval
>cd
Depth CHAOsep12RNA
9,94 804
25,06 1476,833333
40,04 1540,561404
50,11 1575,166667
52,46 349,222222
54,92 1941,5
57,29 1053,507042
60,11 1535,1
70,04 2244,963303
79,97 1954,507042
100,31 2679,140625
>
2016 Apr 21
5
Calcular Error en modelo lineal
Enun ejemplo real estoy viendo como el intervalo de confianza usando lo que me comentas me ha salido mucho más pequeño de lo que la realidad luego refleja. ¿Cómo es esto posible??
Es decir, veo que para valores de 2,70 obtengo una respuesta de entre 2,69 y 2,90 y sin embargo luego en la realidad tengo valores entre 2,20 y 3
Gracias
Jesús
From: jorgeivanvelez en gmail.com
Date: Thu, 21 Apr
2008 Apr 14
2
Bug in ci.plot(HH Package) (PR#11163)
Full_Name: Yasuhiro Nakajima
Version: 2.6.1
OS: WinXP SP2
Submission from: (NULL) (202.237.255.13)
Dear all,
I noticed the following behaviour of ci.plot in HH Package(ver.2.1-9):
> library(HH)
> data(women, package="datasets")
> attach(women)
> ft <- lm(height~weight)
> windows()
> ci.plot(ft,conf.level=0.95)
> windows()
> ci.plot(ft,conf.level=0.999)
I
2002 Nov 15
5
confidence interval in "predict.lm"
I am studying statistics using R and a book "Understandable Statistics", by
Brase and Brase. The book has two
worked examples for calculating a confidence interval around a predicted
value from a linear model. The answers
to the two examples in the book differ from those I get from R. The
regression line, the standard error, and the
predicted value in
R and the book all agree for the
2007 Mar 02
4
significant anova but no distinct groups ?
Dear all,
I am studying a dataset using the aov() function.
The independant variable 'cds' is a factor() with 8 levels and here is
the result in studying the dependant variable 'rta' with aov() :
> summary(aov(rta ~ cds))
Df Sum Sq Mean Sq F value Pr(>F)
cds 7 0.34713 0.04959 2.3807 0.02777
Residuals 92 1.91635 0.02083
The dependant variable
2007 Jul 25
1
Ggplot2 equivalent of axis and problem with log scale
Dear useRs,
Recently I've discorved ggplot2 and I must say that I really like it,
although the documentation still is a working in progress.
My first question: How can I change the position of the labels and the
text of the labels? With a basic plot I would use axis(2, at =
position.of.the.ticks, labels = text.at.the.ticks). Could someone
provide me with an example of how to do this with
2008 Dec 02
1
QQ plots and boxcox
Dear R People:
In the DASL library, there is a story about hot dogs.
Here are the data:
Beef 186 495
Beef 181 477
Beef 176 425
Beef 149 322
Beef 184 482
Beef 190 587
Beef 158 370
Beef 139 322
Beef 175 479
Beef 148 375
Beef 152 330
Beef 111 300
Beef 141 386
Beef 153 401
Beef 190 645
Beef 157 440
Beef 131 317
Beef 149 319
Beef 135 298
Beef 132 253
Meat 173 458
Meat 191 506
Meat 182 473
Meat 190
2007 Nov 20
1
plotting confidence intervals of regression line
Hello,
I am trying to generate a confidence interval (90 or 95%) of a regression
line. This is primarily just for illustration on a scatter plot (i.e. I am
trying to make this
http://www.ast.cam.ac.uk/~rgm/scratch/statsbook/graphics/anima4.gif).
I have been trying to use the predict.lm function, with interval set as
"confidence", but this still seems to be giving me a prediction