Displaying 20 results from an estimated 4000 matches similar to: "predict() still not yet "safe".. (PR#1840)"
2010 Dec 16
2
Compare two dataframes
Hello,
I have two dataframes DF1 and DF2 that should be identical but are not
(DF1 has some rows that aren't in DF2, and vice versa). I would like
to produce a new dataframe DF3 containing rows in DF1 that aren't in
DF2 (and similarly DF4 would contain rows in DF2 that aren't in DF1).
I have a solution for this problem (see self contained example below)
but it's awkward and
2023 Nov 30
1
back tick names with predict function
?s 17:38 de 30/11/2023, Robert Baer escreveu:
> I am having trouble using back ticks with the R extractor function
> 'predict' and an lm() model.? I'm trying too construct some nice vectors
> that can be used for plotting the two types of regression intervals.? I
> think it works with normal column heading names but it fails when I have
> "special"
2009 Jul 09
2
r bug (?) display of data
Hi R Fans,
I stumbled across a strange (I think) bug in R 2.9.1. I have read in a
data file with 5934 rows and 9 columns with the commands:
daten = data.frame(read.table("C:/fussball.dat",header=TRUE))
Then I needed a subset of the data file:
newd = daten[daten[,1]!=daten[,2],]
--> two values do not meet the logical specification and are dropped.
The strange thing about it:
2012 Jul 12
2
nls question
Hi:
Using nls how can I increase the numbers of iterations to go beyond 50.
I just want to be able to predict for the last two weeks of the year.
This is what I have:
weight_random <- runif(50,1,24)
weight <- sort(weight_random);weight
weightData <- data.frame(weight,week=1:50)
weightData
plot(weight ~ week, weightData)
M_model <- nls(weight ~ alpha +
2012 Aug 29
1
Help on not matching object lengths
Dear All
I have the following code set up:
Code #1
a <-matrix(seq(0,8, by = sign(8-0)*0.25))
b <-matrix(seq(8,16, by = sign(16-8)*0.25))
c <-runif(1000,50,60)
d <-exp(-c*a)+exp(-c*b)
This will give me the obvious error message of lengths not matching. What I am trying to do here is to have 33 rows x 1000 columns d values calculated in total. As an eaxmple for visual, this is what
2007 Feb 13
1
Missing variable in new dataframe for prediction
Hi,
I'm using a loop to evaluate several models by taking adjacent variables from my dataframe.
When i try to get predictions for new values, i get an error message about a missing variable in my new dataframe.
Below is an example adapted from ?gam in mgcv package
library(mgcv)
set.seed(0)
n<-400
sig<-2
x0 <- runif(n, 0, 1)
x1 <- runif(n, 0, 1)
x2 <- runif(n, 0, 1)
x3 <-
2011 Apr 09
1
loop and sapply problem, help need
Dear R experts
Sorry for this question
M1 <- 1:10
lcd1 <- c(11, 22, 33, 44, 11, 22, 33, 33, 22, 11)
lcd2 <- c(22, 11, 44, 11, 33, 11, 22, 22, 11, 22)
lcd3 <- c(12, 12, 34, 14, 13, 12, 23, 23, 12, 12)
#generating variables through sampling
pvec <- c("PR1", "PR2", "PR3", "PR4", "PR5", "PR6", "PR7",
2017 Jun 12
0
plotting gamm results in lattice
Hi Maria
If you have problems just start with a small model with predictions and then plot with xyplot
the same applies to xyplot
Try
library(gamm4)
spring <- dget(file = "G:/1/example.txt")
str(spring)
'data.frame': 11744 obs. of 11 variables:
$ WATERBODY_ID : Factor w/ 1994 levels "GB102021072830",..: 1 1 2 2 2 3 3 3 4 4 ...
$ SITE_ID
2007 Feb 23
2
Extracting a subset from a dataframe
Good day everyone,
Can anyone suggest an effective method to solve
the following problem:
I have 2 dataframes D1 and D2 as follows:
D1:
dates ws wc pwc
2005-10-19:12:00 10.8 80 81
2005-10-20:12:00 12.3 5 15
2005-10-21:15:00 12.3 3 15
2005-10-22:15:00 11.3 13 95
2005-10-23:12:00 12.3 13 2
2005-10-24:15:00 10.3 2 95
2005-10-25:15:00 10.3 2 2
D2:
2006 Sep 28
2
safe prediction from lm
I am fitting a regression model with a bs term and then making predictions
based on the model. According to some info on the internet at
http://www.stat.auckland.ac.nz/~yee/smartpred/DummiesGuide.txt
there are some problems with using predict.lm when you have a model with
terms such as bs,ns,or poly. However when I used one of the examples they
said would illustrate the problems I get virtually
2013 Apr 01
2
example to demonstrate benefits of poly in regression?
Here's my little discussion example for a quadratic regression:
http://pj.freefaculty.org/R/WorkingExamples/regression-quadratic-1.R
Students press me to know the benefits of poly() over the more obvious
regression formulas.
I think I understand the theory on why poly() should be more numerically
stable, but I'm having trouble writing down an example that proves the
benefit of this.
I
2013 Jul 08
1
error in "predict.gam" used with "bam"
Hello everyone.
I am doing a logistic gam (package mgcv) on a pretty large dataframe
(130.000 cases with 100 variables).
Because of that, the gam is fitted on a random subset of 10000. Now when I
want to predict the values for the rest of the data, I get the following
error:
> gam.basis_alleakti.1.pr=predict(gam.basis_alleakti.1,
+
2003 Jun 03
3
gam questions
Dear all,
I'm a fairly new R user having two questions regarding gam:
1. The prediction example on p. 38 in the mgcv manual. In order to get
predictions based on the original data set, by leaving out the 'newdata'
argument ("newd" in the example), I get an error message
"Warning message: the condition has length > 1 and only the first element
will be used in: if
2017 Nov 21
2
help
I am working on Johansen cointegration test, using urca and var package.
in the selection of var, I have got following results.
>VARselect(newd, lag.max = 10,type = "none")
$selection
AIC(n) HQ(n) SC(n) FPE(n)
6 6 6 5
$criteria
1 2 3 4
5 6 7 8 9
AIC(n) -3.818646e+01 -3.864064e+01
2017 Nov 21
0
help
Your example is incomplete... as the bottom of this and every post says, we need to be able to proceed from an empty R environment to wherever you are having the problem (reproducible), in as few steps as possible (minimal). The example needs to include data, preferably in R syntax as the dput function creates... see the howtos referenced below for help with that. [1], [2], [3]
You also need to
2012 Apr 02
1
gamm: tensor product and interaction
Hi list,
I'm working with gamm models of this sort, using Simon Wood's mgcv library:
gm<- gamm(Z~te(x,y),data=DATA,random=list(Group=~1))
gm1<-gamm(Z~te(x,y,by=Factor)+Factor,data=DATA,random=list(Group=~1))
with a dataset of about 70000 rows and 110 levels for Group
in order to test whether tensor product smooths vary across factor levels. I was wondering if comparing those two
2023 Nov 30
1
back tick names with predict function
I am having trouble using back ticks with the R extractor function
'predict' and an lm() model.? I'm trying too construct some nice vectors
that can be used for plotting the two types of regression intervals.? I
think it works with normal column heading names but it fails when I have
"special" back-tick names.? Can anyone help with how I would reference
these?? Short of
2012 Mar 29
0
multiple plots in vis.gam()
Hi,
I'm working with gamm models of this sort:
gm<- gamm(Z~te(x,y),data=DATA,random=list(Group=~1))
gm1<-gamm(Z~te(x,y,by=Factor)+Factor,data=DATA,random=list(Group=~1))
with a dataset of about 70000 rows and 110 levels for Group
if I use plot(gm1$gam), I obtain 3 different surface plots, one for each level of my factor but I would like to create more complex contour plots for those 3
2017 Nov 21
2
help
thank you for your valuable reply. I have attached my commands, results, and
data with this mail..maybe it will be beneficial for you to feedback.
On Tue, Nov 21, 2017 at 9:13 PM, Jeff Newmiller <jdnewmil at dcn.davis.ca.us>
wrote:
> Your example is incomplete... as the bottom of this and every post says,
> we need to be able to proceed from an empty R environment to wherever you
2012 Mar 19
1
glm: getting the confidence interval for an Odds Ratio, when using predict()
Say I fit a logistic model and want to calculate an odds ratio between 2
sets of predictors. It is easy to obtain the difference in the predicted
logodds using the predict() function, and thus get a point-estimate OR. But
I can't see how to obtain the confidence interval for such an OR.
For example:
model <- glm(chd ~age.cat + male + lowed, family=binomial(logit))
pred1 <-