Displaying 10 results from an estimated 10 matches for "newdata2".
Did you mean:
newdata
2012 Sep 24
0
stop on rows where !is.na(mydata$ti_all)
..." & !is.na(subdata$ti_all))
new_out_c = ifelse(new_out_c == 0, NA, new_out_c)
new_cma_c = ifelse(new_cma_c == 0, NA, new_cma_c)
return(c(newname, NA, NA, NA, new_out_c, new_cma_c, new_c_n, NA))
}
})
# recombine and sort
colnames(newrows2) = colnames(mydata2)
newdata2 = rbind(mydata2, newrows2)
newdata2 = newdata2[order(newdata2$id), ]
mydata3 <- newdata2
newrows2 <- ddply(mydata3, .(id), function(subdata) {
subdata_ty = subdata[!is.na(subdata$ty_all), ]
if (NROW(subdata) == 1) {
r = subdata[1, ]
c("v_001_arm_1", NA, NA...
2013 Apr 03
1
linear model coefficients by year and industry, fitted values, residuals, panel data
...nd 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 help to get an easier way.
Thank you,
Cecília Ca...
2003 Dec 16
0
Help w/ termplot & predict.coxph/ns
...it$linear.predictors)=0. Am I missing
something here?
3. Using the fitted coeficients:
# Coefficients
fitc<-coef(model.fit)
# Predictors
basis <- ns(x2, df = 3) ; # df= 3 were used to fit the model
newx2<- seq(0,30,length=60)
# new data in the coords of the basis and x1=1 for all obs
newdata2<-cbind(rep(1,60),predict(basis, newx2))
newpred<-newdata2%*%fitc
termplot(model.fit, ylim=c(0,3))
lines(newx2, newpred)
This method gives predictions that appear to be proportional to the
results in termplot - but all predicted values are higher. I am missing
something here?
Ideally, I wo...
2012 Aug 01
1
rpart package: why does predict.rpart require values for "unused" predictors?
After fitting and pruning an rpart model, it is often the case that one or
more of the original predictors is not used by any of the splits of the
final tree. It seems logical, therefore, that values for these "unused"
predictors would not be needed for prediction. But when predict() is called
on such models, all predictors seem to be required. Why is that, and can it
be easily
2023 Jan 15
2
Removing variables from data frame with a wile card
...i.e. column three
# Find the location of the column
ColumToDelete <- grep("th",colnames((mydata)))
cat("The colomumn to be dropped is the column called three, which is column",ColumToDelete,"\n")
ColumToDelete
# Drop the column whose name starts with "th"
newdata2 <- mydata[,-ColumnToDelete]
cat("Data frame after droping column whose name is three\n")
newdata2
I hope this helps.
John
________________________________________
From: R-help <r-help-bounces at r-project.org> on behalf of Valentin Petzel <valentin at petzel.at>
Sent: Sa...
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
2011 Sep 27
0
Keep consecutive year observations (remove gap's) in panel data (dataframes). Difficulties in using lag(). Package plm.
...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
(Universidade de Aveiro – Portugal)
[[alternative HTML version deleted]]
2023 Jan 14
1
Removing variables from data frame with a wile card
Hello Avi,
while something like d$something <- ... may seem like you're directly modifying the data it does not actually do so. Most R objects try to be immutable, that is, the object may not change after creation. This guarantees that if you have a binding for same object the object won't change sneakily.
There is a data structure that is in fact mutable which are environments. For
2003 Apr 03
4
Two y-axis in plots
Hi,
I am trying to plot two data sets on one plot but with using a different y-axis ranges for each - preferably with one shown on each side of the graph.
Is there a function that will allow me to do this.
Thanks
Allan McRae
[[alternate HTML version deleted]]
2013 May 21
1
keep the centre fixed in K-means clustering
Dear R users
I have the matrix of the centres of some clusters, e.g. 20 clusters each
with 100 dimentions, so this matrix contains 20 rows * 100 columns numeric
values.
I have collected new data (each with 100 numeric values) and would like to
keep the above 20 centres fixed/'unmoved' whilst just see how my new data
fit in this grouping system, e.g. if the data is close to cluster 1