Displaying 20 results from an estimated 63 matches for "pred1".
Did you mean:
preds
2008 Dec 13
2
weird pasting of ".value" when list is returned
...atenated
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&l...
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...
2013 Jan 18
1
scaling of nonbinROC penalties
...achieve any value for accuracy - including unity - by re-scaling the penalty matrix. So, I'd like to ask what, if any are the contraints on the scaling process?
Here is a working code that illustrates my difficulty:-
set.seed(1); gldstd=round(runif(200)*4); gldstd[gldstd==0]=4; table(gldstd)
pred1=gldstd*rnorm(200, mean=1, sd=2/gldstd); boxplot(pred1~gldstd)
library(nonbinROC); gldstd=ordered(gldstd)
ordered_penalty = matrix(c(0,0,0,0,1/3,0,0,0,2/3,1/3,0,0,1,2/3,1/3,0), nrow = 4)
constant_penalty = matrix(c(0,0,0,0,1,0,0,0,1,1,0,0,1,1,1,0), nrow = 4)
# first using the constant_penalty (defa...
2009 Feb 23
1
Follow-up to Reply: Overdispersion with binomial distribution
...r too much overdispersion - mine seems to be
huge......Residual deviance: 1580.1 on 123 degrees of freedom
I do have some outliers - but they are legitimate (i.e., not typos).....
I included my data below....if it helps
summary(glm.D93)$dispersion ## 1 (by definition)
Call:
glm(formula = y ~ Pred1, family = "binomial")
Deviance Residuals:
Min 1Q Median 3Q Max
-9.940 -2.778 -0.710 2.130 10.479
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 1.63942 0.07205 22.753 < 2e-16 ***
Pred1F -0.65228 0.11781 -5.537 3.08e...
2012 Mar 19
1
glm: getting the confidence interval for an Odds Ratio, when using predict()
...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 <- 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
...ass is "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...
2005 Mar 03
3
creating a formula on-the-fly inside a function
...that, among 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...
2011 Sep 06
1
Question about Natural Splines (ns function)
Hi - How can I 'manually' reproduce the results in 'pred1' below? My attempt
is pred_manual, but is not correct. Any help is much appreciated.
library(splines)
set.seed(12345)
y <- rgamma(1000, shape =0.5)
age <- rnorm(1000, 45, 10)
glm1 <- glm(y ~ ns(age, 4), family=Gamma(link=log))
dd <- data.frame(age = 16:80)
mm <- model.matrix( ~...
2008 Sep 11
1
how to calcaulate matrices for two subsets
I am an R beginner and trying to run a market model using event study in
R framework.
First, I run a market model, that is lm(stock security~SP500 index,
subset=Obs[197, 396]) ->result1
Then I get predict results for a new dataset using predict (result1,
newdata=Obs[397,399]) ->pred1
Pred1 should have three numbers.
Now I need to calculate abnormal return by the formula stock security
[397,399] -pred1
But it does not work after trying many times.
So, how to write a R code to implement the formula and get right
results.
Thanks,
Bill
[[alternative HTML ver...
2013 Sep 27
0
Best and Worst values
Ira,
obj_name<- load("arun.RData")
Pred1<- get(obj_name[1])
Actual1<- get(obj_name[2])
dat2<- data.frame(S1=rep(Pred1[,1],ncol(Pred1)-1),variable=rep(colnames(Pred1)[-1],each=nrow(Pred1)),Predict=unlist(Pred1[,-1],use.names=FALSE),Actual=unlist(Actual1[,-1],use.names=FALSE),stringsAsFactors=FALSE)
dat2New<- dat2[!(is.na(dat2...
2009 May 12
1
ROCR: auc and logarithm plot
Hi,
I am quite new to R and I have two questions regarding ROCR.
1. I have tried to understand how to extract area-under-curve value by looking at the ROCR document and googling. Still I am not sure if I am doing the right thing. Here is my code, is "auc1" the auc value?
"
pred1 <- prediction(resp1,label1)
perf1 <- performance(pred1,"tpr","fpr")
plot( perf1, type="l",col=1 )
auc1 <- performance(pred1,"auc")
auc1 <- auc1@y.values[[2]]
"
2. I have to compare two models that have very close ROCs. I'd like to have...
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 fo...
2013 Sep 25
1
Best and worst values for each date
Hi,
May be you can try this:
obj_name<- load("arun.RData")
Pred1<- get(obj_name[1])
Actual1<- get(obj_name[2])
library(reshape2)
dat<-cbind(melt(Pred1,id.vars="S1"),value2=melt(Actual1,id.vars="S1")[,3])? # to reshape to long form
colnames(dat)[3:4]<- c("Predict","Actual")
dat$variable<- as.character(dat$var...
2007 Sep 04
1
data.frame loses name when constructed with one column
Not sure why the data.frame function does not capture the name of the column field when its being built with only one column.
Can anyone help?
> data
out pred1 predd2
1 1 2.0 3.0
2 2 3.5 5.5
3 3 5.5 11.0
> data1=data.frame(data[,1])
> data1
data...1.
1 1
2 2
3 3
> data1=data.frame(data[,1:2])
> data1
out pred1
1 1 2.0
2 2 3.5
3 3 5.5
> sessionInfo()
R version 2.5.1 (2007-06-27)
i3...
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;
2017 Oct 06
2
Using response variable in interaction as explanatory variable in glm crashes R
...result.
tab <- structure(list(dob_day = c(FALSE, FALSE, FALSE, FALSE, TRUE,
TRUE, TRUE, TRUE), dob_mon = c(FALSE, FALSE, TRUE, TRUE, FALSE,
FALSE, TRUE, TRUE), dob_year = c(FALSE, TRUE, FALSE, TRUE, FALSE,
TRUE, FALSE, TRUE), n = c(1489634L, 17491L, 134985L, 1639L, 47892L,
611L, 4365L, 750L), pred1 = c(1488301, 18187, 135605, 1657, 48547,
593, 4423, 54)), .Names = c("dob_day", "dob_mon", "dob_year",
"n", "pred1"), row.names = c(NA, -8L), class = "data.frame")
m <- glm(dob_mon ~ dob_day*dob_mon, data = tab, family = binomial())...
2006 Aug 04
0
training svm's with probability flag
...t machines.
data(iris)
attach(iris)
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...
2006 Aug 04
0
training svm's with probability flag (re-send in plain text)
...t machines.
data(iris)
attach(iris)
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...
2008 Apr 25
1
fix variance parameter values for lmer estimation
...and only allow for one
iteration ?
my question is how to do that ?
to specify the 2x2 matrix of variance parameter values:
start=list(groups=array(2,-0.5,1),dim=c(2,2))
now I need to make sure the mean structure is estimated, while the variance
parameter values are kept constant ??
e.g. lmer(resp~pred1+pred2+(1 +
pred1|groups),start=list(groups=array(2,-0.5,1),dim=c(2,2)),....)
cheers,
Wilfried
Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm