Displaying 20 results from an estimated 35 matches for "pred2".
Did you mean:
preds
2008 Dec 13
2
weird pasting of ".value" when list is returned
...d
onto it when the code below is run and temp is returned.
I've been trying to figure this out for too long. It doesn't matter when
I put the FPVAL in the return statement. It happens regardless of
whether it's first or last. Thanks.
f.lmmultenhanced <-
function(response, pred1, pred2)
{
regmod <- lm(response ~ pred1 + pred2)
lmsum <- summary(regmod)
imbcoef<-lmsum$coefficients[2,1]
retcoef<-lmsum$coefficients[3,1]
imbpval<-lmsum$coefficients[2,4]
retpval<-lmsum$coefficients[3,4]
Fstat<-lmsu...
2004 Jun 16
2
gam
hi,
i'm working with mgcv packages and specially gam. My exemple is:
>test<-gam(B~s(pred1)+s(pred2))
>plot(test,pages=1)
when ploting test, you can view pred1 vs s(pred1, edf[1] ) & pred2 vs
s(pred2, edf[2] )
I would like to know if there is a way to access to those terms
(s(pred1) & s(pred2)). Does someone know how?
the purpose is to access to equation of smooths terms in order to...
2007 Dec 19
1
library(rpart) or library(tree)
...ted a simple new.data.frame:
new.data.fame <- data.frame
new.data.frame[,"JTemp"] <- 10.5
new.data.frame[,"SNied"] <- 430
Than I used predict() to predict values for "pnV22" in the following way:
pred <- predict(result, data.frame)
pred2 <- predict(result, new.data.frame)
The results are the same, which I checked by ploting the values of pred and pred2 and by
table(pred ==pred2) which is true for all values.
Looking at the tree I would expect that pred2 has the same high value for all elements of the
vector. Did I make a...
2012 Mar 19
1
glm: getting the confidence interval for an Odds Ratio, when using predict()
...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 <- predict(model, newdata=data.frame(age.cat=1,male=1,lowed=1))
pred2 <- predict(model, newdata=data.frame(age.cat=2,male=0,lowed=0))
OR <- exp(pred2-pred1)
Thanks
[[alternative HTML version deleted]]
2007 Jun 04
3
Extracting lists in the dataframe $ format
...ot;dataframe". These indexed lists can be printed successfuly but are not agreeable to the plot() and lm() functions shown below as are their df$out references. Reading the documentation for plot and lm hasn't helped yet. Thanks in advance - Stan.
> df=data.frame(out=1:4*3,pred1=1:4,pred2=1:4*2)
> regression=function(tble,a,b)
+ {
+ plot.new()
+ plot(tble[a]~tble[b])
+ lmm=lm(tble[a]~tble[b])
+ abline(lmm)
+ anova(lmm)
+ }
> df[1]
out
1 3
2 6
3 9
4 12
> df
out pred1 pred2
1 3 1 2
2 6 2 4...
2005 Mar 03
3
creating a formula on-the-fly inside a function
...g other things, runs a linear model and
returns r2. But, the number of predictor variables passed to the
function changes from 1 to 3. How can I change the formula inside the
function depending on the number of variables passed in?
An example:
get.model.fit <- function(response.dat, pred1.dat, pred2.dat = NULL,
pred3.dat = NULL)
{
res <- lm(response.dat ~ pred1.dat + pred2.dat + pred3.dat)
summary(res)$r.squared
# other stuff happens here...
}
y <- rnorm(10)
x1 <- y + runif(10)
x2 <- y + runif(10)
x3 <- y + runif(10)
get.model.fit(y, x1, x2, x3)
get.model.fit(y, x1,...
2016 Nov 01
2
as.formula("x") error on C stack limit
Dear all,
I tried to run as.formula("x") and got an error message "Error: C stack
usage 7971120 is too close to the limit" whether x exists or not. This is
not the case in as.formula("y"), where "object 'y' not found" is the error
message if y not exists, or "invalid formula" error or a formula depending
on y. Can anyone confirm this is
2009 Jun 12
1
coupled ODE population model
I'm fairly new to R, and I'm trying to write out a population model that
satisfies the following;
the system consists of s species, i= 1, 2,...,s
network of interactions between species is specified by a (s x s) real matrix,
C[i,j]
x[i] being the relative population of the "ith" species (0 =< x[i] =< 1,
sum(x[i]=1)
the evolution rule being considered is as follows;
2010 May 28
1
Comparing and Interpreting GAMMs
...Groups Name Variance Std.Dev.
vpnr (Intercept) 0.12965 0.36007
Xr.1 s(hours24) 1291.42444 35.93639
Number of obs: 97920, groups: vpnr, 114; Xr.1, 8
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
X(Intercept) 0.3713345 0.0644469 5.762 8.32e-09 ***
Xpred2 -0.0575848 0.0865231 -0.666 0.506
Xpred3 0.0003748 0.0869543 0.004 0.997
…
Parametric coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 0.3713345 0.0149858 24.779 < 2e-16 ***
pred2 -0.0575848 0.0197488 -2.916 0.0035...
2006 Aug 04
0
training svm's with probability flag
...library(e1071)
train<- iris[c(1:30,50:80,100:130),]
test<- iris[-c(1:30,50:80,100:130),]
y.train<- train$Species
y.test<- test$Species
obj<- tune.svm(train[,-5], y.train, gamma = 2^(-1:1), cost = 2^(2:4),
probability=T)
my.svm<- obj$best.model
pred1<- predict(my.svm, test[,-5])
pred2<- predict(my.svm, test[,-5], probability=T)
table(pred1, y.test)
table(pred2, y.test)
When I do this, the two different tables often come out different, as below:
> table(pred1, y.test)
y.test
pred1 setosa versicolor virginica
setosa 19 0 0
ver...
2006 Aug 04
0
training svm's with probability flag (re-send in plain text)
...library(e1071)
train<- iris[c(1:30,50:80,100:130),]
test<- iris[-c(1:30,50:80,100:130),]
y.train<- train$Species
y.test<- test$Species
obj<- tune.svm(train[,-5], y.train, gamma = 2^(-1:1), cost = 2^(2:4),
probability=T)
my.svm<- obj$best.model
pred1<- predict(my.svm, test[,-5])
pred2<- predict(my.svm, test[,-5], probability=T)
table(pred1, y.test)
table(pred2, y.test)
When I do this, the two different tables often come out different, as below:
> table(pred1, y.test)
y.test
pred1 setosa versicolor virginica
setosa 19 0 0
ver...
2003 Apr 25
1
validate function in Design library does not work with small samples
...dels. When
my sample size is reduced from 300 to 150, the
function complains (length of dimnames[1] not equal to
array) and does not produce any results. There are no
missing values in the data. Any suggestions for a
work-around?
Thank you in Advance.
>
f.total=cph(Surv(fu,censor)~predictor+pred2+pred3,data=data,x=T,y=T,surv=T)
> set.seed(6)
> val.step=validate(f.total,B=155,bw=T)
Backwards Step-down - Original Model
No Factors Deleted
Factors in Final Model
[1] pred2
.Random.seed: 1 -1021164091 1170333634 in .GlobalEnv
Iteration:
1 2 3 4 5 6 7 Error in fit(NULL,...
2006 May 27
1
Recommended package nlme: bug in predict.lme when an independent variable is a polynomial (PR#8905)
...ta = Newdata)
>
> # "correct" model matrix for predictions
> p <- poly(Orthodont$age, 3)
> mm2 <- model.matrix(~ poly(age, 3, coefs = attr(p, "coefs")) + Sex, data =
Newdata)
>
> data.frame(pred1 = predict(fm, level = 0, newdata = Newdata),
+ pred2 = mm1 %*% fixef(fm),
+ pred3 = head(predict(fm, level = 0)),
+ pred4 = mm2 %*% fixef(fm))
pred1 pred2 pred3 pred4
1 18.61469 18.61469 23.13079 23.13079
2 23.23968 23.23968 24.11227 24.11227
3 29.90620 29.90620 25.59375 25.59375
4 36.19756 36.19756 27.03819 27.038...
2024 Jul 13
1
Obtaining predicted probabilities for Logistic regression
...Dat)
Model = glm(Purchased ~ Gender, data = Dat, family = binomial())
# use matrix algebra
x <- cbind(1, (Dat$Gender == "Male")) %*% coef(Model)
pred1 <- exp(x)/(1 + exp(x))
# use the fitted line equation
y <- coef(Model)[1L] + coef(Model)[2L] * (Dat$Gender == "Male")
pred2 <- exp(y)/(1 + exp(y))
head(predict(Model, type="response"))
head(pred1) |> c()
head(pred2)
Hope this helps,
Rui Barradas
--
Este e-mail foi analisado pelo software antiv?rus AVG para verificar a presen?a de v?rus.
www.avg.com
2016 Nov 01
0
as.formula("x") error on C stack limit
...env")
Error: object of type 'special' is not subsettable
> as.formula("...")
Error in eval(expr, envir, enclos) : '...' used in an incorrect context
It may happen for the same reason that the following does not give an error:
> y <- "response ~ pred1 + pred2"
> as.formula("y")
response ~ pred1 + pred2
and that the followings give a somewhat surprising result
> f <- function(x) { y <- "foo ~ bar" ; as.formula(x) }
> f("y")
response ~ pred1 + pred2
<environment: 0x1e87978>
The character method fo...
2008 May 13
0
Un-reproductibility of SVM classification with 'e1071' libSVM package
...ed(15)
model = svm(data.frame(x, y), as.factor(c), probability=TRUE )
pred1 = predict( model, newdata = data.frame(x2, y2), probability=TRUE)
probas1 = as.numeric(attr(pred1,"probabilities")[,"TRUE"])
set.seed(15)
model = svm(data.frame(x, y), as.factor(c), probability=TRUE )
pred2 = predict( model, newdata = data.frame(x2, y2), probability=TRUE)
probas2 = as.numeric(attr(pred2,"probabilities")[,"TRUE"])
sum(pred1 != pred2) # It should be 0
sum(probas1 != probas2) # It should be 0
plot(probas1,probas2,xlim=c(0.4,0.6),ylim=c(0.4,0.6),col="red&q...
2011 Apr 06
3
ROCR - best sensitivity/specificity tradeoff?
Hi,
My questions concerns the ROCR package and I hope somebody here on the list can help - or point me to some better place.
When evaluating a model's performane, like this:
pred1 <- predict(model, ..., type="response")
pred2 <- prediction(pred1, binary_classifier_vector)
perf <- performance(pred, "sens", "spec")
(Where "prediction" and "performance" are ROCR-functions.)
How can I then retrieve the cutoff value for the sensitivity/specificity tradeoff with regard to the d...
2011 Sep 03
2
ROCR package question for evaluating two regression models
...~ x4+ x5+ x6+ x7, data = dat, family = binomial(link=logit))model2 <- glm (Y~ x1 + x2 +x3 , data = dat, family = binomial(link=logit))
and I would like to compare these two models based on the prediction that I get from each model:
pred1 = predict(model1, test.data, type = "response")pred2 = predict(model2, test.data, type = "response")
I have used ROCR package to compare them:pr1 = prediction(pred1,test.y)pf1 = performance(pr1, measure = "prec", x.measure = "rec") plot(pf1) which cutoff this plot is based on?
pr2 = prediction(pred2,test.y)pf2 = perform...
2012 Nov 01
0
oblique.tree : the predict function asserts the dependent variable to be included in "newdata"
...e prediction does not seem to depend upon
### the values of the dependent variable included in the data
pred1 <- predict(bot, newdata = test[, var_names],
type="vector", update.tree.predictions = F);
test$y <- as.factor(sample(0:1, size = dim(test)[1], replace = T))
pred2 <- predict(bot, newdata = test[, var_names],
type="vector", update.tree.predictions = F);
abs(mean(pred1[,1] - pred2[,1]))
if (abs(mean(pred1[,1] - pred2[,1])) > 1e-3) {
print("Results do differ.");
}
### What is more curious is that the error messa...
2009 Apr 01
3
How to prevent inclusion of intercept in lme with interaction
....lme1)
# How go force intercept = 0 ???
grd.lme0 = lme(newbone~t*treat-1,data=grd,random=~1|subject)
grd$pred0 = predict(grd.lme0,level=0)
summary(grd.lme0)
# Gives true,
all.equal(grd$pred1,grd$pred0)
# Everything as expected without treat
grd.lme2 = lme(newbone~t,data=grd,random=~1|subject)
grd$pred2 = predict(grd.lme2,level=0)
summary(grd.lme2)
# Forced intercept = 0
grd.lme3 = lme(newbone~t-1,data=grd,random=~1|subject)
grd$pred3 = predict(grd.lme3,level=0)
summary(grd.lme3)
# As expected: not equal
all.equal(grd$pred2,grd$pred3)
#------------------------------------------------------------...