[R] RMySQL

2006-11-07 Thread Xiaodong Jin
  options(CRAN='http://cran.r-project.org')
  install.packages(RMySQL, type=source)
   
  Warning: unable to access index for repository 
http://www.ibiblio.org/pub/languages/R/CRAN/src/contrib
Warning: unable to access index for repository 
http://www.stats.ox.ac.uk/pub/RWin/src/contrib
Warning in download.packages(unique(pkgs), destdir = tmpd, available = 
available,  : 
 no package 'RMySQL' at the repositories

  Thanks!

 
-
Sponsored Link 

Talk more and pay less. Vonage can save you up to $300 a year on your phone 
bill. Sign up now.
[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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] nls

2006-11-07 Thread Xiaodong Jin
 y
[1]   1  11  42  64 108 173 214
   
   t
[1] 1 2 3 4 5 6 7
   
   nls(1/y ~ c*exp(-a*b*t)+1/b, start=list(a=0.001,b=250,c=5), trace=TRUE)
29.93322 :0.001 250.000   5.000 
Error in numericDeriv(form[[3]], names(ind), env) : 
Missing value or an infinity produced when evaluating the model
   
  # the start value for b is almost close to final estimates, 
  # a is usually small positive close to 0
  # c is a positive number
  # Do I need different estimation method?
   
  Regards
  xj
   
   

 
-

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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] query in R

2006-11-07 Thread Xiaodong Jin
how to realize the following SQL command in R?
   
  select distinct A, B, count(C)
  from TABLE
  group by A, B
  ;
  quit;
   
  Best Regards

 
-
Sponsored Link

Get a free Motorola Razr! Today Only! Choose Cingular, Sprint, Verizon, Alltel, 
or T-Mobile.
[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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] Rprofile.site

2006-11-06 Thread Xiaodong Jin
How to make it correct?
  [1]
  Error in parse(file, n = -1, NULL, ?) : syntax error at
1: {\
  #source('c:/Documents and Settings/xxx/My Documents/Archives/R/test.r')
  #source(c:\\Documents and Settings\\xxx\\My 
Documents\\Archives\\R\\test.r)
   
  [2]
  Error in file(file, r, encoding = encoding) : 
unable to open connection
In addition: Warning message:
cannot open file 'c:Documents and Settings
bkcjsvMy DocumentsArchivesH606R est.r', reason 'Invalid argument' 
   
  #source(c:\Documents and Settings\xxx\My Documents\Archives\R\test.r)
   

 
-

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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] nls

2006-08-15 Thread Xiaodong Jin
  Is there anyway to change any y[i] value (i=2,...6) to make following NLS 
workable? 
   
  x - c(0,5,10,15,20,25,30)
  y - c(1.0,0.82000,0.68000,0.64000,0.7,0.68667,0.64000)
  lm(1/y ~~ x)
  nls(1/y ~~ a+b*x^c, start=list(a=1.16122,b=0.01565,c=1), trace=TRUE)
   
  #0.0920573 :  1.16122 0.01565 1.0 
#Error in numericDeriv(form[[3]], names(ind), env) : 
#Missing value or an infinity produced when evaluating the model


-


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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] convert ms() to optim()

2006-07-07 Thread Xiaodong Jin
  How to convert the following ms() in Splus to Optim in R? The Calc function 
is also attached.
   
  ms(~ Calc(a.init, B, v, off, d, P.a, lambda.a, P.y, lambda.y,
  10^(-8), FALSE, 20, TRUE)$Bic,
  start = list(lambda.a = 0.5, lambda.y = 240),
  control = list(maxiter = 10, tol = 0.1))
   
  Calc - function(A.INIT., X., V., OFF., D.,
  P1., LAMBDA1., P2., LAMBDA2.,
  TOL., MONITOR., MAX.ITER., TRACE.){
  lambda1 - abs(LAMBDA1.)
  lambda2 - abs(LAMBDA2.)
  P - lambda1 * P1. + lambda2 * P2.
  a - Estimate(A.INIT., X., V., OFF., D., P,
  TOL., MONITOR., MAX.ITER.)
  Ita - OFF. + X. %*% a
  Mu - c(exp(Ita))
  Wt - Mu * V.
  Bt.W.B - t(X.) %*% (Wt * X.)
  BtWBplusP - Bt.W.B + P
  Rhs - Bt.W.B %*% a + t(X.) %*% (V. * (D. - Mu))
  a - solve(BtWBplusP, Rhs)
  Tr - sum(diag(solve(BtWBplusP, Bt.W.B)))
  y.init - D.
  y.init[D.==0] - 10^(-4)
  Dev - 2*sum( V. * D.*log(y.init/Mu) )
  Bic - Dev + log(sum(V.)) * Tr
  Hazard - Ita - OFF.
  if (TRACE. == TRUE) cat(lambda1, lambda2, Bic, \n)
  return(a, Hazard, Tr, Dev, Bic, BtWBplusP)
   
  Thanks, 
  Shelton


-

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] auto load package splines

2006-07-05 Thread Xiaodong Jin
May I ask how to include following procedures into R script (such as first.r) 
such that it will do an automatical call next time after I open R?
   
  Packages - Load Packages - splines
   
  Thanks,
  Shelton


-

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] garch function in R

2005-11-21 Thread Xiaodong Jin
I'm using R 2.1.1 and just successfully installed packages tseries, fseries.
   
  I try to run example
  http://www.maths.lth.se/help/R/.R/library/tseries/html/garch.html
  But it shows
   x.arch - garch(x, order = c(0,2))  # Fit ARCH(2) 
Error: couldn't find function garch
   
  Then I run command
   help.search(garch)
  it shows the R information.
   
  Which package(s) do I really need to run garch models?
   
  Thanks,
  Shelton


-

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] arima prediction

2005-11-21 Thread Xiaodong Jin
x-c(-1.873,-0.121)  # 23 numerics;
  x.arma12 - armaFit(x ~ arma(1,2))
  #estimates y[t]= -0.11465 - 0.23767 y[t-1] - 0.14230 e[t-1] -0.85770 e[t-2] + 
e[t];
   
  # ? how to predict 46 steps ahead based on 23 data points? 
  # the following doesn't work since n is in armaSim rather than armaFit;
  predict(x.arima12, n.ahead=46) 
   
  # Thanks


-

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] change maxiter for nls

2005-10-21 Thread Xiaodong Jin
I typed the following commands but it still use maxiter=50 after the 2nd 
command:
 
nls.control(maxiter = 1000)
nls(..)
 
Thanks!



-

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] curve fit

2005-10-20 Thread Xiaodong Jin
How to obtain the FUNCTION for the following smooth curve?
x 0100 250 500 1000  4000
y 1.8  1.2 1.02 0.99 0.97 0.85
 
Thanks,
SJ


-

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html