Displaying 8 results from an estimated 8 matches for "newdata1".
Did you mean:
newdata
2008 Apr 12
2
Predict Function
Hi all - my first time here and am having an issue with the Predict function.
I am using a tutorial as a guide, locate here:
http://www.ats.ucla.edu/STAT/R/dae/mlogit.htm
My code gives this error
> newdata1$predicted <- predict(mlogit,newdata=newdata1,type="response")
Error in `$<-.data.frame`(`*tmp*`, "predicted", value = c(0.332822934960197,
:
replacement has 810 rows, data has 6
How can I resolve this problem so I can just predict values for the supplied
matrix(newdat...
2010 Feb 18
1
logistic regression - what is being predicted when using predict - probabilities or odds?
...) data set ("data") using logistic regression (glm):
logreg1 <- glm(z ~ x1 + x2 + y, data=data, family=binomial("logit"),
na.action=na.pass)
Then, I created a data frame with 2 fixed levels (0 and 1) for each predictor:
attach(data)
x1<-c(0,1)
x2<-c(0,1)
y<-c(0,1)
newdata1<-data.frame(expand.grid(x1,x2,y))
names(newdata1)<-c("x1","x2","y")
Finally, I calculated model-predicted probabilities for each
combination of those fixed levels:
newdata1$predicted <-predict(logreg1,newdata=newdata1, type="response")
I am pretty...
2013 May 21
1
keep the centre fixed in K-means clustering
...a simpler example:
I have
Centre<- matrix(c(0,1,0,1), nrow=2)
# the two created centres in a two dimentional case are
Centre
[,1] [,2]
[1,] 0 0
[2,] 1 1
NewData<-rbind(matrix(rnorm(100, sd = 0.3), ncol = 2),
matrix(rnorm(100, mean = 1, sd = 0.3), ncol = 2))
NewData1<-cbind(c1:100), NewData)
colnames(NewData1)<-c("ID","x","y")
# my data
head(NewData1)
ID x y
[1,] 1 -0.3974660 0.1541685
[2,] 2 0.5321347 0.2497867
[3,] 3 0.2550276 0.1691720
[4,] 4 -0.1162162 0.6754874
[5,] 5 0.1570996 0.117...
2013 Apr 03
1
linear model coefficients by year and industry, fitted values, residuals, panel data
...obtain the estimates of b0, b1 and b2 by industry and year (for example I need to have de b0 for industry 20 and year 2000, for industry 20 and year 2001...). Then I need to calculate the fitted values and the residuals by firm so I need to keep b0, b1 and b2 in a way that I could do something like
newdata1<-transform(final3,Y'=b0+b1.X+b2.Z)
newdata2<-transform(newdata1,residual=Y-Y')
or another way to keep Y' and the residuals in a dataframe with the columns firm and year.
Until now I have been doing this in very hard way and because I need to do it several times, I need your hel...
2008 Jun 15
2
How to take the average of multiple rows
Dear all,
I have a matrix, called newdata1,
> dim(newdata1)
[1] 34176 83
It looks like:
EntrezID Name S1 S2 S3 S4 S5.....
1 4076 CAPRIN1 0.1 0.2 0.3...
2 139170 WDR40B 0.4 0.5 0.6...
3 5505 PPP1R2P1 0.3 0.3 0.7...
4 4076 CAPRIN1 0.7...
2012 Dec 12
2
help with predict.glm, and charting with factors
Dear R Wizards,
After much frustration and days of confusion I have finally broken down and
am asking for help, which I don’t like doing, but I just can’t figure this
one out on my own. I’ve conducted a laboratory experiment testing the
effects of temperature and salinity on whether or not a biological event
will occur (Go or NoGo). I’ve coded the factors temperature and salinity
as factors for
2008 Jun 14
1
how to select out some columns using cbind()
Hello! I have a matrix:
> dim(data1)
[1] 34176 581
of 34176 rows and 581 columns,
I want to make a new matrix data2 by taking the 2nd column, 9th column, 16th
column....
the column number is in the order of:
2
9 (2+7)
16 (9+7)
23 (16+7)
...
the new matrix data2 should include 83 columns, is there an easy way to
do that using cbind() function?
Thanks a lot!
Allen
[[alternative HTML
2011 Sep 27
0
Keep consecutive year observations (remove gap's) in panel data (dataframes). Difficulties in using lag(). Package plm.
...rm 2)
year firm x
1 2001 1 11
2 2002 1 22
3 2003 1 32
4 2004 1 25
5 2005 1 26
6 2004 2 98
7 2005 2 101
8 2001 3 14
9 2002 3 87
10 2003 3 56
Second, I need to create a new variable that is the lagged value of x. I''ve
done
newdata1<-transform(data1,y=lag(x,1))
But it doesn''t work.
I also need to create a new variable that is the opposite of lag(). I''ve
done
newdata2<-transform(data1,z=lag(x,-1))
But, of course, it doesn''t work neither.
Thank you for all your help.
Cecília Carmo...