Re: [R] timeseries plot

2010-04-03 Thread vibha patel
Hello,

YearERISSRIFTRIDFSRIIFSRITRISRIPSRIERI2
199540.1829.4841.4635.9835.5448.1579.5
11.1526.50120923
199642.9642929.144.0139.3130.4247.5179.78
30.6235.83816143
199744.8585724.4844.9247.3835.6154.2781.89
25.4635.83816143
199847.4985727.7347.4350.0530.7357.2181.51
37.8335.83816143
199948.7471424.9950.8356.9836.3956.8483.58
31.6235.83816143
200050.9336.0547.9355.5839.4954.4783.82
39.1735.83816143
200151.2085737.8845.850.5842.6457.4185.82
38.3335.83816143
200253.7933.6152.4952.8649.9364.2787.19
36.1835.83816143
200361.3585730.8758.1770.363.0172.2586.5
48.4135.83816143
200460.2085730.8563.0960.9462.9876.8386.33
40.4435.83816143
200563.4528635.4464.8366.1759.8876.5489.83
51.4835.83816143
200665.1042934.569.7457.3259.1382.0498.46
54.5435.83816143


This is the dataset.
for research i'm applying earth function on the dataset.
the code is given below.

the dataset:HCMecoref

i want to plot prdHCMeco. but as the dataset is divided into training and
testing sets,
it only plots for testing data.

i've refered ur reply.
still having problem.

and yes, i've refered ?ts.plot too.

tr.ecoref-sample(1:nrow(HCMecoref), 0.8*nrow(HCMecoref))
tst.ecoref- (1:nrow(HCMecoref))[-tr.ecoref]
HCMecoModel-earth(ERI~SSRI+FTRI+DFSRI+IFSRI+TRI+SRI+PSRI+ERI2,data=HCMecoref[tr.ecoref,])
prdHCMeco-predict(HCMecoModel, newdata=HCMecoref[tst.ecoref,])
#e2HCM-HCMecoref$ERI[tst.ecoref]
#RecoHCM-(1-sum((e2HCM - prdHCMeco)^2)/sum((e2HCM-mean(e2HCM))^2))
#print(RecoHCM)


ts_ecoref-ts(data=prdHCMeco,...)
plot(ts_ecoref)

how to plot training dataset and testing dataset together in this case???

Thanks

Vibha.




On Fri, Apr 2, 2010 at 7:12 PM, Gabor Grothendieck
ggrothendi...@gmail.comwrote:

 Here are a few ways:

 Try this:

 set.seed(123)
 TS - ts(1:25 + rnorm(25))
 tt - time(TS)
 tt.pred - end(tt)[1] + 1:10
 both - ts(c(TS, predict(lm(TS ~ tt), list(tt = tt.pred
 ts.plot(both, TS, gpars = list(type = o, col = 2:1, pch = 20))

 and read ?ts, ?start, ?ts.plot and next time please provide some
 sample data using dput.  See last line to every message and the
 posting guide.

 On Fri, Apr 2, 2010 at 8:14 AM, vibha patel vibhapatel...@gmail.com
 wrote:
  Hello,
 
  I am using plot( ) function to plot time-series.
 
  it takes time-series object as an argument
  but i want to plot predicted data with training set, to compare them.
 
  is there any function available?
 
 
  Vibha
 
 [[alternative HTML version deleted]]
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] what is the significance of RSq in earth function??

2010-04-02 Thread vibha patel
Hello,

I'm using earth function for Multivariate Adaptive Regression splines.

what is the significance of RSq in earth function??

following's the code.
printed value is of RSq.

 tr.wage-sample(1:nrow(HCMwage), 0.8*nrow(HCMwage))
 tst.wage- (1:nrow(HCMwage))[-tr.wage]

HCMwageModel-earth(V2~V3+V4+V5+V6+V7+V8+V9+V10+V11+V12+W,data=HCMwage[tr.wage,])
 prdHCMwage-predict(HCMwageModel, newdata=HCMwage[tst.wage,])
 wg2HCM-HCMwage$V2[tst.wage]
 RwageHCM-(1-sum((wg2HCM - prdHCMwage)^2)/sum((wg2HCM-mean(wg2HCM))^2))
 print(RwageHCM)
[1] 0.3204129


Thanks and Regards,
Vibha

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] timeseries plot

2010-04-02 Thread vibha patel
Hello,

I am using plot( ) function to plot time-series.

it takes time-series object as an argument
but i want to plot predicted data with training set, to compare them.

is there any function available?


Vibha

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] fitness of regression tree: how to measure???

2010-04-01 Thread vibha patel
Hello,

I'm using rpart function for creating regression trees.
now how to measure the fitness of regression tree???

thanks n Regards,
Vibha

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] time series datasets

2010-03-31 Thread vibha patel
Hello,

I am searching large multivariate time series datasets to use with R.

Can any one help me???


Regards,
Vibha

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] package earth - forward pass: out of memory error, how to resolve this?

2010-03-29 Thread vibha patel
Hello,

while using earth function, I'm getting the out of memory error:
the dataset is too small(dimension is displayed in code).
how to resole this error?

 tr.sub1 - sample(1:nrow(HCMauto), .8 * nrow(HCMauto))
 tst.sub1 - (1:nrow(HCMauto))[-tr.sub1]
 HCMm1 - earth(V1 ~ ., data = HCMauto[tr.sub1, ])
Error in forward.pass(x, y, standardized.weights, scale.y, trace, penalty,
:
  Out of memory (could not allocate 2017.29 MBytes)

 dim(HCMauto)
[1] 85 10
 dim(HCMauto[tr.sub1,])
[1] 68 10


Thanks.

Vibha

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] how to measure accuracy of regression tree?

2010-03-26 Thread vibha patel
Hello,

for constructing regression tree, I am using rpart function.

now after dividing dataset in to training and testing,
I'm using predict for forecasting.

how to measure accuracy of the predicted data?

Thanks and Regards,
Vibha.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] how to solve error in precict( ) while using with rpart?

2010-03-24 Thread vibha patel
Hello,

I am working with rpart function but geting some error in prediction.
the same code works fine with iris dataset.

but applying other dataset it doesn't work.
sample code is given for reference.

 acc_model-rpart(V1~V2+V3+V4+V5+V6+V7+V8, data=accEx.train)
 plotcp(acc_model)

acc_find_cp-(acc_model$cptable)[,CP][which.min(acc_model$cptable[,xerror])]
 acc_prune_model-prune(acc_model,acc_find_cp)
 acc_predict_tree-predict(acc_prune_model,newdata=accEx.test,
type=class)
Error in predict.rpart(acc_prune_model, newdata = accEx.test, type =
class) :
  Invalid prediction for rpart object

#conf.mat
#function(true, new)
{
t - table(true, new)
s - sum(t)
acc - round((sum(diag(t)))/s, 2)
res - list(conf = t, accuracy = acc)
}

# I thought the Error is  in match.arg(type) :
# 'arg' should be one of “vector”, “prob”, “class”, “matrix”

# accEx.test # V1 is response V2 to V8 are predictors
 V1  V2V3  V4   V5V6 V7  V8
1   3.66356 7.74414  -4.4 4.2  0.0  18.0 19 116
2   3.04452 8.03398  -5.7 4.8 -0.3  69.1  9 506
3   3.71357 4.70048 -13.5 4.3  0.2  80.0  3  95
4   2.9 7.52510   1.4 3.0  0.1 177.0 22 161
5   4.06044 7.76260   4.1 5.6  1.1 287.0  7  80
6   3.6 7.88683   5.8 2.3 -0.1 200.0  9  33
7   3.33220 7.81521   2.7 1.9  0.4 228.0  7 129
8   3.36730 7.9   7.1 8.9  0.2 220.0 15 155
9   2.07944 6.89163   4.1 2.0  0.1 183.0  9 132
10  1.94591 7.67740   1.1 5.2  0.1  43.1 10 480
..
..
..

 acc_predict_tree-predict(acc_prune_model,newdata=accEx.test,
type=vector)
 acc_conf-conf.mat(accEx.train,acc_predict_tree)
Error in sort.list(unique.default(x), na.last = TRUE) :
  'x' must be atomic for 'sort.list'
Have you called 'sort' on a list?

how to solve this problem?

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] how to use node info generated by rpart in mars?

2010-03-23 Thread vibha patel
I am working on rpart, mars and earth.
they all work fine individually.
but i want to use node information generated by rpart in earth or mars.
(mars is sensitive to outliers. CART deals effectively with outliers.)

is there any way to perform this?

Thanks.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] how to use node info generated by rpart in mars?

2010-03-23 Thread vibha patel
I am working on rpart, mars and earth.
they all work fine individually.
but i want to use node information generated by rpart in earth or mars.
(mars is sensitive to outliers. CART deals effectively with outliers.)

is there any way to perform this?

Thanks.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.