Re: [R] simple save question

2011-07-13 Thread Tom La Bone

Well, that took a bit of detective work! Thanks. I am still not doing
something right here in my efforts to implement the easy way. Can you
point out my error?
 
 library(survival)
 library(ISwR)
 dat.s - Surv(melanom$days,melanom$status==1)
 fit - survfit(dat.s~1)
 print(fit, print.rmean=TRUE)
Call: survfit(formula = dat.s ~ 1)

   records  n.maxn.start events *rmean *se(rmean) median 
   205205205 57   4125161 NA 
   0.95LCL0.95UCL 
NA NA 
* restricted mean with upper limit =  5565 
 sfit - summary(fit) 
 sfit$table[ ,5] 
Error in sfit$table[, 5] : incorrect number of dimensions


--
View this message in context: 
http://r.789695.n4.nabble.com/simple-save-question-tp3429148p3664808.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


Re: [R] simple save question

2011-07-13 Thread Tom La Bone

No cigar. This is what I get and my session info. Any suggestions?
 
 library(survival)
 library(ISwR)
 dat.s - Surv(melanom$days,melanom$status==1)
 fit - survfit(dat.s~1)
 print(fit, print.rmean=TRUE)
Call: survfit(formula = dat.s ~ 1)

   records  n.maxn.start events *rmean *se(rmean) median 
   205205205 57   4125161 NA 
   0.95LCL0.95UCL 
NA NA 
* restricted mean with upper limit =  5565 
 sfit - summary(fit) 
 sfit$table[5] 
median 
NA 



 sessionInfo()
R version 2.13.1 (2011-07-08)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C  
[5] LC_TIME=English_United States.1252

attached base packages:
[1] splines   stats graphics  grDevices utils datasets  methods  
[8] base 

other attached packages:
[1] ISwR_2.0-5  survival_2.36-9 rj_0.5.5-4 

loaded via a namespace (and not attached):
[1] tools_2.13.1




--
View this message in context: 
http://r.789695.n4.nabble.com/simple-save-question-tp3429148p3665289.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


Re: [R] simple save question

2011-07-13 Thread Tom La Bone
I want to assign the value of rmean from a survfit object to a variable so
that it can be used in subsequent calculations, which is also what I
interpreted the original poster to want. I did not understand Dr. Therneau's
answer to the original poster, so I figured I would provide a simple example
and see if someone could spoon feed me on how to do this. Dr. Winsemius
seemed to have gotten an answer, but I have not been able to reproduce it. 

It appears to me that summary(fit) and summary.survfit(fit), where fit is an
object created by survfit, are the same thing (the example on the
summary.survfit help page reinforces this idea). I have played with the
rmean=getOption('survfit.rmean') option in summary but I can't seem to get
anywhere. 

Tom

--
View this message in context: 
http://r.789695.n4.nabble.com/simple-save-question-tp3429148p3665554.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


Re: [R] simple save question

2011-07-12 Thread Tom La Bone

Here is a worked example. Can you point out to me where in temp rmean is
stored? Thanks.

Tom


 library(survival)
 library(ISwR)
 
 dat.s - Surv(melanom$days,melanom$status==1)
 fit - survfit(dat.s~1)
 plot(fit)
 summary(fit)
Call: survfit(formula = dat.s ~ 1)

 time n.risk n.event survival std.err lower 95% CI upper 95% CI
  185201   10.995 0.004960.9851.000
  204200   10.990 0.007000.9761.000
  210199   10.985 0.008550.9681.000
  232198   10.980 0.009850.9611.000
  279196   10.975 0.011000.9540.997
  295195   10.970 0.012020.9470.994
  386193   10.965 0.012970.9400.991
  426192   10.960 0.013840.9330.988
  469191   10.955 0.014650.9270.984
  529189   10.950 0.015420.9200.981
  621188   10.945 0.016150.9140.977
  629187   10.940 0.016830.9070.973
  659186   10.935 0.017480.9010.970
  667185   10.930 0.018110.8950.966
  718184   10.925 0.018700.8890.962
  752183   10.920 0.019270.8830.958
  779182   10.915 0.019810.8770.954
  793181   10.910 0.020340.8710.950
  817180   10.904 0.020840.8650.946
  833178   10.899 0.021340.8590.942
  858177   10.894 0.021810.8530.938
  869176   10.889 0.022270.8470.934
  872175   10.884 0.022720.8410.930
  967174   10.879 0.023150.8350.926
  977173   10.874 0.023570.8290.921
  982172   10.869 0.023970.8230.917
 1041171   10.864 0.024360.8170.913
 1055170   10.859 0.024740.8120.909
 1062169   10.854 0.025110.8060.904
 1075168   10.849 0.025470.8000.900
 1156167   10.844 0.025820.7940.896
 1228166   10.838 0.026160.7890.891
 1252165   10.833 0.026490.7830.887
 1271164   10.828 0.026810.7770.883
 1312163   10.823 0.027130.7720.878
 1435161   10.818 0.027440.7660.874
 1506159   10.813 0.027740.7600.869
 1516155   10.808 0.028050.7550.865
 1548152   10.802 0.028370.7490.860
 1560150   10.797 0.028680.7430.855
 1584148   10.792 0.028990.7370.851
 1621146   10.786 0.029290.7310.846
 1667137   10.780 0.029630.7250.841
 1690134   10.775 0.029980.7180.836
 1726131   10.769 0.030330.7120.831
 1933110   10.762 0.030850.7040.825
 2061 95   10.754 0.031550.6940.818
 2062 94   10.746 0.032210.6850.812
 2103 90   10.737 0.032900.6760.805
 2108 88   10.729 0.033580.6660.798
 2256 80   10.720 0.034380.6560.791
 2388 75   10.710 0.035230.6450.783
 2467 69   10.700 0.036190.6330.775
 2565 63   10.689 0.037290.6200.766
 2782 57   10.677 0.038540.6050.757
 3042 52   10.664 0.039940.5900.747
 3338 35   10.645 0.043070.5660.735
 
 print(fit, print.rmean=TRUE)
Call: survfit(formula = dat.s ~ 1)

   records  n.maxn.start events *rmean *se(rmean) median 
   205205205 57   4125161 NA 
   0.95LCL0.95UCL 
NA NA 
* restricted mean with upper limit =  5565 
 
 temp - summary(fit)
 str(temp)
List of 12
 $ surv: num [1:57] 0.995 0.99 0.985 0.98 0.975 ...
 $ time: num [1:57] 185 204 210 232 279 295 386 426 469 529 ...
 $ n.risk  : num [1:57] 201 200 199 198 196 195 193 192 191 189 ...
 $ n.event : num [1:57] 1 1 1 1 1 1 1 1 1 1 ...
 $ conf.int: num 0.95
 $ type: chr right
 $ table   : Named num [1:7] 205 205 205 57 NA NA NA
  ..- attr(*, names)= chr [1:7] records n.max n.start events ...
 $ n.censor: num [1:57] 0 0 0 1 0 0 0 0 0 0 ...
 $ std.err : num [1:57] 0.00496 0.007 0.00855 0.00985 0.011 ...
 $ lower   : num [1:57] 0.985 0.976 0.968 0.961 0.954 ...
 $ upper   : num [1:57] 1 1 1 1 0.997 ...
 $ call: language survfit(formula = 

Re: [R] simple save question

2011-07-12 Thread Tom La Bone
Thank you for the reply Dr. Winsemius. Can you take your answer a step
further and, in the context of the simple, reproducible example, illustrate
how it is done? I would appreciate it.

Tom 

--
View this message in context: 
http://r.789695.n4.nabble.com/simple-save-question-tp3429148p3663645.html
Sent from the R help mailing list archive at Nabble.com.

__
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 Extract Information from SIMEX Output

2011-04-18 Thread Tom La Bone
Below is a SIMEX object that was generated with the simex function from the
simex package applied to a logistic regression fit. From this mountain of
information I would like to extract all of the values summarized in this
line:

  .. ..$ variance.jackknife: num [1:5, 1:4] 1.684 1.144 0.85 0.624 0.519 ...

Can someone suggest how to go about doing this? I can extract the upper
level results like fit.simex$coefficients but I have had no success getting
at the lower levels.

Tom


 str(fit.simex)
List of 24
 $ coefficients : Named num [1:2] -17.1 3
  ..- attr(*, names)= chr [1:2] (Intercept) x
 $ SIMEX.estimates  : num [1:6, 1:3] -1 0 0.5 1 1.5 ...
  ..- attr(*, dimnames)=List of 2
  .. ..$ : NULL
  .. ..$ : chr [1:3] lambda (Intercept) x
 $ lambda   : num [1:5] 0 0.5 1 1.5 2
 $ model:List of 31
  ..$ coefficients : Named num [1:2] -13.27 2.32
  .. ..- attr(*, names)= chr [1:2] (Intercept) x
  ..$ residuals: Named num [1:1615] -1.12 -1.42 -1.23 -1.07 -1.44
...
  .. ..- attr(*, names)= chr [1:1615] 1 2 3 4 ...
  ..$ fitted.values: Named num [1:1615] 0.1032 0.2952 0.1847 0.0656
0.3062 ...
  .. ..- attr(*, names)= chr [1:1615] 1 2 3 4 ...
  ..$ effects  : Named num [1:1615] 19.552 -9.275 -0.473 -0.283
-0.641 ...
  .. ..- attr(*, names)= chr [1:1615] (Intercept) x   ...
  ..$ R: num [1:2, 1:2] -15.6 0 -81 -4
  .. ..- attr(*, dimnames)=List of 2
  .. .. ..$ : chr [1:2] (Intercept) x
  .. .. ..$ : chr [1:2] (Intercept) x
  ..$ rank : int 2
  ..$ qr   :List of 5
  .. ..$ qr   : num [1:1615, 1:2] -15.6232 0.0292 0.0248 0.0159 0.0295 ...
  .. .. ..- attr(*, dimnames)=List of 2
  .. .. .. ..$ : chr [1:1615] 1 2 3 4 ...
  .. .. .. ..$ : chr [1:2] (Intercept) x
  .. ..$ rank : int 2
  .. ..$ qraux: num [1:2] 1.02 1.02
  .. ..$ pivot: int [1:2] 1 2
  .. ..$ tol  : num 1e-11
  .. ..- attr(*, class)= chr qr
  ..$ family   :List of 12
  .. ..$ family: chr binomial
  .. ..$ link  : chr logit
  .. ..$ linkfun   :function (mu)  
  .. ..$ linkinv   :function (eta)  
  .. ..$ variance  :function (mu)  
  .. ..$ dev.resids:function (y, mu, wt)  
  .. ..$ aic   :function (y, n, mu, wt, dev)  
  .. ..$ mu.eta:function (eta)  
  .. ..$ initialize:  expression({ if (NCOL(y) == 1) { if
(is.factor(y))  y - y != levels(y)[1L] n - rep.int(1,
nobs) y[weights == 0] - 0 if (any(y  0 | y  1)) 
stop(y values must be 0 = y = 1) mustart - (weights * y +
0.5)/(weights + 1) m - weights * y if (any(abs(m -
round(m))  0.001))  warning(non-integer #successes in a
binomial glm!) } else if (NCOL(y) == 2) { if (any(abs(y -
round(y))  0.001))  warning(non-integer counts in a binomial
glm!) n - y[, 1] + y[, 2] y - ifelse(n == 0, 0, y[, 1]/n)

weights - weights * n mustart - (n * y + 0.5)/(n + 1) }
else stop(for the binomial family, y must be a vector of 0 and 1's\n, 
or a 2 column matrix where col 1 is no. successes and col 2 is no.
failures) })
  .. ..$ validmu   :function (mu)  
  .. ..$ valideta  :function (eta)  
  .. ..$ simulate  :function (object, nsim)  
  .. ..- attr(*, class)= chr family
  ..$ linear.predictors: Named num [1:1615] -2.162 -0.87 -1.485 -2.656
-0.818 ...
  .. ..- attr(*, names)= chr [1:1615] 1 2 3 4 ...
  ..$ deviance : num 1521
  ..$ aic  : num 1525
  ..$ null.deviance: num 1622
  ..$ iter : int 4
  ..$ weights  : Named num [1:1615] 0.0926 0.208 0.1506 0.0613
0.2125 ...
  .. ..- attr(*, names)= chr [1:1615] 1 2 3 4 ...
  ..$ prior.weights: Named num [1:1615] 1 1 1 1 1 1 1 1 1 1 ...
  .. ..- attr(*, names)= chr [1:1615] 1 2 3 4 ...
  ..$ df.residual  : int 1613
  ..$ df.null  : int 1614
  ..$ y: Named num [1:1615] 0 0 0 0 0 0 0 0 0 0 ...
  .. ..- attr(*, names)= chr [1:1615] 1 2 3 4 ...
  ..$ converged: logi TRUE
  ..$ boundary : logi FALSE
  ..$ model:'data.frame':   1615 obs. of  2 variables:
  .. ..$ y: Factor w/ 2 levels 0,1: 1 1 1 1 1 1 1 1 1 1 ...
  .. ..$ x: num [1:1615] 4.79 5.35 5.09 4.58 5.37 ...
  .. ..- attr(*, terms)=Classes 'terms', 'formula' length 3 y ~ x
  .. .. .. ..- attr(*, variables)= language list(y, x)
  .. .. .. ..- attr(*, factors)= int [1:2, 1] 0 1
  .. .. .. .. ..- attr(*, dimnames)=List of 2
  .. .. .. .. .. ..$ : chr [1:2] y x
  .. .. .. .. .. ..$ : chr x
  .. .. .. ..- attr(*, term.labels)= chr x
  .. .. .. ..- attr(*, order)= int 1
  .. .. .. ..- attr(*, intercept)= int 1
  .. .. .. ..- attr(*, response)= int 1
  .. .. .. ..- attr(*, .Environment)=environment: R_GlobalEnv 
  .. .. .. ..- attr(*, predvars)= language list(y, x)
  .. .. .. ..- attr(*, dataClasses)= Named chr [1:2] factor numeric
  .. .. .. .. ..- attr(*, names)= chr [1:2] y x
  ..$ x: num [1:1615, 1:2] 1 1 1 

Re: [R] Failing to install {rggobi} on win-7 R 2.12.0

2011-01-25 Thread Tom La Bone

I recall that my problem on Windows was related to having a number of stray
versions of GTK+ installed. I went back and deleted all versions and
reinstalled the latest GTK+ and that seemed to fix things. However, when I
went to do any work of substance ggobi locked up and became unresponsive.
Never did get it working right on Windows. Had much more luck with R/ggobi
on Ubuntu 10.10.

Tom
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Failing-to-install-rggobi-on-win-7-R-2-12-0-tp3236602p3237166.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


Re: [R] Tutorial Tinn-R

2010-07-23 Thread Tom La Bone

Seems to be a relevant and reasonable question to me. 
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Tutorial-Tinn-R-tp2300451p2300648.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


Re: [R] Sampling with replacement

2010-06-16 Thread Tom La Bone

How about


library(TeachingSampling)
SupportWR(20,4)


Tom
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Sampling-with-replacement-tp2257450p2257644.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


Re: [R] Ellipse that Contains 95% of the Observed Data

2010-03-29 Thread Tom La Bone

Concisely, here is what I am trying to do:

#I take a random sample of 300 measurements. After I have the measurements 
#I post stratify them to 80 type A measurements and 220 type B measurements. 
#These measurements tend to be lognormally distributed so I fit them to 
#determine the geometric mean and geometric standard deviation of each
stratum. 
#The question is: are the geometric mean and geometric standard deviation of 
#the type A measurements the same as the geometric mean and geometric 
#standard deviation of the type B measurements?


library(MASS)
library(car)
setwd(C:/Documents and Settings/Tom/workspace/Work)
source(bagplot.r) 
#http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=112

#Here are the data. Unknown to me, they are indeed drawn from the same
#lognormal distribution
X - cbind(1:300,rlnorm(300,log(30),log(3)))
X.A - X[1:80,2]
X.B - X[81:300,2]

#These are the data I see. Fit the type A and type B measurements
fit.XA - fitdistr(X.A,lognormal)
fit.XB - fitdistr(X.B,lognormal)

#Fit 2000 random samples of size 80 and 220 and calculate the difference in
#the GM and GSD for each
x - numeric(2000)
y - numeric(2000)
for (i in 1:2000) {
k - sample(X[,1],80,replace=FALSE)
x.a - X[k,2]
x.b - X[setdiff(1:300,k),2]
fit.xa - fitdistr(x.a,lognormal)
fit.xb - fitdistr(x.b,lognormal)
x[i] - coef(fit.xa)[1] - coef(fit.xb)[1]
y[i] - coef(fit.xa)[2] - coef(fit.xb)[2]
}

#Create the bagplot and superimpose the 95% joint normal confidence ellipse. 
#Does the difference in GM and GSD actually observed for the type A and type
B
#measurements look like the result of the random draw?
bagplot(x,y,show.whiskers=FALSE,approx.limit=1000)
data.ellipse(x,y,plot.points=FALSE,levels=c(0.95),col=black,center.cex=0)
box()
points(coef(fit.XA)[1]-coef(fit.XB)[1],coef(fit.XA)[2]-coef(fit.XB)[2],
cex=1.5,col=black,pch=19)


-- 
View this message in context: 
http://n4.nabble.com/Ellipse-that-Contains-95-of-the-Observed-Data-tp1694538p1695134.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


Re: [R] Ellipse that Contains 95% of the Observed Data

2010-03-29 Thread Tom La Bone

I know what get a bigger sample means. I have no clue what ask a more
statistically meaningful question means. Can you elaborate a bit?

Tom
-- 
View this message in context: 
http://n4.nabble.com/Ellipse-that-Contains-95-of-the-Observed-Data-tp1694538p1695357.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Design of a survey using the survey package

2010-03-28 Thread Tom La Bone

I have looked through the new Complex Surveys book and the documentation
for the survey package and it appears to me that there are no functions in
survey that help one to design a sampling scheme. For example, in the book
section 2.8 discusses the design of stratified samples, but there is no
mention of any functions in the survey package that implement the
discussed strategies. So, am I missing something obvious here or is the
survey package meant only for analyzing survey data once you have it in
hand?

Tom 
-- 
View this message in context: 
http://n4.nabble.com/Design-of-a-survey-using-the-survey-package-tp1694075p1694075.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Ellipse that Contains 95% of the Observed Data

2010-03-28 Thread Tom La Bone

I can take the results of a simulation with one random variable and generate
an empirical interval that contains 95% of the observations, e.g.,

x - rnorm(1)
quantile(x,probs=c(0.025,0.975))

Is there an R function that can take the results from two random variables
and generate an empirical ellipse that contains 95% of the observations,
e.g.,  

x - rnorm(1)
y - rnorm(1)
?

I am specifically looking for an ellipse that does not assume normality.

Tom


-- 
View this message in context: 
http://n4.nabble.com/Ellipse-that-Contains-95-of-the-Observed-Data-tp1694538p1694538.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


Re: [R] Ubunut + Eclipse + StatET: Console terminates upon error

2010-03-11 Thread Tom La Bone

I don't want to hijack the thread here, but since you mentioned hover pop-up
help can you suggest a way to turn it OFF, totally and completely?

Tom LaBone
-- 
View this message in context: 
http://n4.nabble.com/Ubunut-Eclipse-StatET-Console-terminates-upon-error-tp1589479p1589800.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


Re: [R] Rounding a Measurement to be Consistent with its Uncertainty

2009-12-05 Thread Tom La Bone


Uwe Ligges-3 wrote:
 
 
 
 Tom La Bone wrote:
 I have a measurement of 8165.666 and an uncertainty of 338.9741 (the
 units of
 both are unimportant). I can easily round the uncertainty to two
 significant
 digits with signif(338.9741,2), which gives 340. Is there a function in R
 that will take 8165.666 and round it to be consistent with its
 uncertainty,
 i.e., 8170?
 
 That's not consistent, you have 3 significant digits here, but 2 for the 
 uncertainty (whatever that is) ...
 
 Uwe Ligges
 
 
 
 Tom
 
 In metrology, what I did is indeed consistent (provided that I have
 correctly interpreted the guidance given in the ISO Guide to the
 Expression of Uncertainty in Measurement). The uncertainty is basically a
 way of specifying in which digits I begin to doubt my result. So, I while
 I will usually have two digits in my uncertainty, I can have 10
 significant digits in my result. Some folks have given me some ideas
 off-line on how to write a function that will round a number in this
 fashion, but I always prefer to use an existing R function if it already
 exists rather than write my own. And, with the tens of thousands of R
 functions in existence, it is always a good idea to ask the forum if they
 know of one.
 
 Tom
 
 
 
 
 
 __
 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.
 
 

-- 
View this message in context: 
http://n4.nabble.com/Rounding-a-Measurement-to-be-Consistent-with-its-Uncertainty-tp948151p949395.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Rounding a Measurement to be Consistent with its Uncertainty

2009-12-03 Thread Tom La Bone

I have a measurement of 8165.666 and an uncertainty of 338.9741 (the units of
both are unimportant). I can easily round the uncertainty to two significant
digits with signif(338.9741,2), which gives 340. Is there a function in R
that will take 8165.666 and round it to be consistent with its uncertainty,
i.e., 8170?

Tom
-- 
View this message in context: 
http://n4.nabble.com/Rounding-a-Measurement-to-be-Consistent-with-its-Uncertainty-tp948151p948151.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


Re: [R] Comparison of Output from dwtest and durbin.watson

2009-08-04 Thread Tom La Bone

Allow me to reword this question. I have performed two fits to the same set
of data below: a weighted fit and an unweighted fit. I performed the
Durbin-Watson tests on each fit using dwtest and durbin.watson. For a
given fit (weighted or unweighted), should both dwtest and durbin.watson be
giving me the same DW statistic and p-value? Should I get the same DW
statistic and p-value for the weighted and unweighted fits as I do using
dwtest?


 library(lmtest)
Loading required package: zoo

Attaching package: 'zoo'


The following object(s) are masked from package:base :

 as.Date.numeric 

 library(car)
 X - c(4.8509E-1,8.2667E-2,6.4010E-2,5.1188E-2,3.4492E-2,2.1660E-2,
+ 3.2242E-3,1.8285E-3)
 Y - c(2720,1150,1010,790,482,358,78,35)
 W - 1/Y^2
 
 fit - lm(Y ~ X - 1)
 dwtest(fit,alternative=two.sided)

Durbin-Watson test

data:  fit 
DW = 0.7599, p-value = 0.05935
alternative hypothesis: true autocorelation is not 0 

 durbin.watson(fit,alternative=two.sided)
 lag Autocorrelation D-W Statistic p-value
   1   0.5897666 0.7599161   0.368
 Alternative hypothesis: rho != 0
 
 fit - lm(Y ~ X - 1,weights=W)
 dwtest(fit,alternative=two.sided)

Durbin-Watson test

data:  fit 
DW = 0.7599, p-value = 0.05935
alternative hypothesis: true autocorelation is not 0 

 durbin.watson(fit,alternative=two.sided)
 lag Autocorrelation D-W Statistic p-value
   1 -0.07663672  1.2090760.77
 Alternative hypothesis: rho != 0
 

-- 
View this message in context: 
http://www.nabble.com/Comparison-of-Output-from-%22dwtest%22-and-%22durbin.watson%22-tp24783494p24808540.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


Re: [R] Comparison of Output from dwtest and durbin.watson

2009-08-04 Thread Tom La Bone

My concern is that the two tests give different DW statistics for the
weighted fit and very different p-values for the same DW statistic for the
unweighted fit. Is there a right answer here?





-- 
View this message in context: 
http://www.nabble.com/Comparison-of-Output-from-%22dwtest%22-and-%22durbin.watson%22-tp24783494p24809734.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Character from Symbol Font on rgl Plot

2009-08-02 Thread Tom La Bone

I want to print characters from the symbol font (or perhaps even Wingdings)
in an rgl 3d plot, but I am having no luck. So, what do I have to do in
order to get this snippet to print out a character from the symbol font?

library(rgl)
open3d()
text3d(1,1,1,a,adj=c(0.5,0.5),cex=10,family=symbol,font=1)

I am on Windows XP with R 2.9.1.

Tom


-- 
View this message in context: 
http://www.nabble.com/Character-from-Symbol-Font-on-rgl-Plot-tp24781990p24781990.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Comparison of Output from dwtest and durbin.watson

2009-08-02 Thread Tom La Bone

Should dwtest and durbin.watson be giving me the same DW statistic and
p-value for these two fits?


library(lmtest)
library(car)
X - c(4.8509E-1,8.2667E-2,6.4010E-2,5.1188E-2,3.4492E-2,2.1660E-2,
3.2242E-3,1.8285E-3)
Y - c(2720,1150,1010,790,482,358,78,35)
W - 1/Y^2

fit - lm(Y ~ X - 1)
dwtest(fit,alternative=two.sided)
durbin.watson(fit,alternative=two.sided)

fit - lm(Y ~ X - 1,weights=W)
dwtest(fit,alternative=two.sided)
durbin.watson(fit,alternative=two.sided)


Tom

-- 
View this message in context: 
http://www.nabble.com/Comparison-of-Output-from-%22dwtest%22-and-%22durbin.watson%22-tp24783494p24783494.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Selecting Bootstrap Method for Quantile Regression

2009-07-30 Thread Tom La Bone

The help page and vignette for summary.rq(quantreg) mention that there are
three different bootstrap methods available for the se=bootstrap argument,
but I can't figure out how to select a particular method. For example, if I
want to use the xy-pair bootstrap how do I indicate this in summary.rq?

Tom
-- 
View this message in context: 
http://www.nabble.com/Selecting-Bootstrap-Method-for-Quantile-Regression-tp24737299p24737299.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Re placing a + in a string

2009-05-21 Thread Tom La Bone

I know this is easy, but I am stumped:
 
 gsub(0,K,8.00+00)
[1] 8.KK+KK

 gsub(+,K,8.00+00)
Error in gsub(+, K, 8.00+00) : invalid regular expression '+'
In addition: Warning message:
In gsub(+, K, 8.00+00) :
  regcomp error:  'Invalid preceding regular expression'

I don't understand the error message. How do I go about replacing the + in
the string 8.00+00 with another character?

Tom




-- 
View this message in context: 
http://www.nabble.com/Replacing-a-%22%2B%22-in-a-string-tp23655515p23655515.html
Sent from the R help mailing list archive at Nabble.com.

__
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] R 64-bit for Ubuntu 9.04 64-bit

2009-04-26 Thread Tom La Bone

I just installed Ubuntu 9.04 but there does not seem to be repository for
binaries for this version. Are there going to be such repositories set up in
the near future?

Tom   
-- 
View this message in context: 
http://www.nabble.com/R-64-bit-for-Ubuntu-9.04-64-bit-tp23246229p23246229.html
Sent from the R help mailing list archive at Nabble.com.

__
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] R 2.9.0 MASS package

2009-04-20 Thread Tom La Bone

I can't seem to find MASS for the latest version of R. Is it coming or has
the name of the package changed?

Tom
-- 
View this message in context: 
http://www.nabble.com/R-2.9.0-MASS-package-tp23144198p23144198.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


Re: [R] R 2.9.0 MASS package

2009-04-20 Thread Tom La Bone

In Windows Xp Pro:

R2.8.1 USA(CA1) repository

markerSearchPower
MASS(VR)
MasterBayes


R2.9.0 USA(CA1) repository

markerSearchPower
MasterBayes

MASS is not where it used to be. I checked a couple of other repositories in
the US and got similar results.

Tom





Peter Dalgaard wrote:
 
 Tom La Bone wrote:
 I can't seem to find MASS for the latest version of R. Is it coming or
 has
 the name of the package changed?
 
 Tom
 
 Where did you look?
 
 It is in the sources (as part of VR), and also in my (SUSE) test builds.
 
 -- 
 O__   Peter Dalgaard Ă˜ster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
   (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
 ~~ - (p.dalga...@biostat.ku.dk)  FAX: (+45) 35327907
 
 __
 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.
 
 

-- 
View this message in context: 
http://www.nabble.com/R-2.9.0-MASS-package-tp23144198p23144721.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


Re: [R] what is R best for; what should one learn in addition to R

2009-04-20 Thread Tom La Bone

What do folks think about the c/gsl/Apophenia combination as one of the other
stat packages?

http://modelingwithdata.org/

http://apophenia.sourceforge.net/

Tom





Greg Snow-2 wrote:
 
 
 I also recommend that people doing statistics know at least the basics of
 3 different stats packages (S-Plus and R don't count as 2 separate
 packages)
 
 -- 
 Gregory (Greg) L. Snow Ph.D.
 Statistical Data Center
 Intermountain Healthcare
 greg.s...@imail.org
 801.408.8111
 
 

-- 
View this message in context: 
http://www.nabble.com/what-is-R-best-for--what-should-one-learn-in-addition-to-R-tp23139415p23145728.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Physical Units in Calculations

2009-04-12 Thread Tom La Bone

Back in 2005 I had been doing most of my work in Mathcad for over 10 years.
For a number of reasons I decided to switch over to R. After much effort and
help from you folks I am finally thinking in R rather than thinking in
Mathcad and trying to translating to R. Anyway, the only task I still use
Mathcad for is calculations that involve physical quantities and units. For
example, in Mathcad I can add 1 kilometer to 1 mile and get the right answer
in the units of length I choose. Likewise, if I try to add 1 kilometer to 1
kilogram I get properly chastised. Is there a way in R to assign quantities
and units to numbers and have R keep track of them like Mathcad does? 

Tom
-- 
View this message in context: 
http://www.nabble.com/Physical-Units-in-Calculations-tp23016092p23016092.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Inverse of data.ellipse function

2009-02-04 Thread Tom La Bone


The following code generates 85% and 95% bivariate normal confidence
ellipses using the data.ellipse routine in the car package. Can anyone
suggest a routine in R that will tell me the confidence ellipse that would
intersect the green point, or more generally, any specified point on the
plot?

Tom


library(car)

x - c(
 2.495507,2.800855,1.956886,2.093559,2.317661,2.134128,2.445757,2.449865,
 2.157123,2.656724,2.514258,2.049239,2.302236,2.187003,2.064303,2.307158,
 2.639794,2.095725,2.055517,2.095392,2.499140,1.997258,2.099004,2.485946,
 2.390299,2.380655,1.986580,2.452259,2.016017,2.115884,2.448890,2.039421,
 2.086519,1.905574,2.507067,2.222586,2.232333,2.286176,2.065320,2.136335,
 1.956130,2.211561,2.196912,2.527431,1.935607,2.482722,2.234416,1.892957,
 2.261484,2.172877,2.429097,2.132760,1.915024,2.474201,2.108019,2.098176,
 2.464809,2.242213,2.604528,2.221102,2.226034,2.285435,1.981518,2.026446,
 2.190195,2.108399,2.554589,1.866505,2.569580,2.263412,2.037287,1.723514,
 2.068335,1.960022,2.233751,2.357066,2.164031,2.001292,2.356718,1.974896,
 2.263872,2.483966,2.517231,2.346250,2.072050,2.110444,2.230884,2.501742,
 2.239098,1.858333,2.104560,2.195149,2.501683,2.079934,2.397314,2.152187,
 2.359440,2.111259,2.160616,1.976223)

y - c(
 -5.600474,-5.661683,-5.007292,-4.874088,-5.339055,-5.858137,-5.594482,
 -5.826471,-5.959325,-6.031502,-5.381492,-5.232014,-5.497670,-5.151676,
 -5.520301,-5.589677,-6.037540,-4.999751,-6.166536,-4.722158,-5.876276,
 -5.420056,-5.773584,-5.428882,-5.669146,-5.546504,-4.973831,-6.201381,
 -5.217770,-4.969737,-5.905475,-5.390086,-5.003606,-4.937802,-5.324172,
 -4.991389,-5.500224,-5.836389,-5.136990,-5.067671,-5.189699,-5.273695,
 -5.761629,-5.400335,-4.672323,-5.390257,-5.176363,-4.747799,-5.246505,
 -5.357218,-5.819997,-5.307132,-4.660002,-5.103505,-5.060687,-5.242942,
 -5.357381,-4.881723,-5.952129,-5.361586,-5.202132,-5.522287,-5.638168,
 -5.589786,-4.997126,-5.116822,-5.786722,-5.205465,-5.836223,-5.730740,
 -5.345793,-5.081353,-4.932470,-5.917560,-5.001224,-5.050188,-5.246825,
 -5.303896,-5.945083,-5.001067,-5.296180,-6.290440,-5.682263,-5.526831,
 -6.298252,-5.361611,-5.422722,-5.356166,-5.618755,-5.141482,-5.472014,
 -4.973340,-5.608222,-4.600451,-5.638057,-5.093730,-5.221353,-5.497442,
 -4.817821,-5.767386)


means - c(mean(x),mean(y))
sigma2 - var(cbind(x,y)) 
sx - sqrt(sigma2[1,1])
sy - sqrt(sigma2[2,2])


a - c(means[1]+qnorm(0.975)*sx,means[2]+qnorm(0.975)*sy)
a

plot(x,y)
data.ellipse(x,y,levels=c(0.85,0.95))
points(a[1],a[2],col=green,pch=19)
abline(h=a[2])
abline(v=a[1])

-- 
View this message in context: 
http://www.nabble.com/Inverse-of-data.ellipse-function-tp21843738p21843738.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Extracting Coefficients and Such from mle2 Output

2009-01-31 Thread Tom La Bone

The mle2 function (bbmle library) gives an example something like the
following in its help page. How do I access the coefficients, standard
errors, etc in the summary of a?
 
 x - 0:10
 y - c(26, 17, 13, 12, 20, 5, 9, 8, 5, 4, 8)
 LL - function(ymax=15, xhalf=6)
+   -sum(stats::dpois(y, lambda=ymax/(1+x/xhalf), log=TRUE))
 a - mle2(LL, fixed=list(xhalf=6))
 summary(a)
Maximum likelihood estimation

Call:
mle2(minuslogl = LL, fixed = list(xhalf = 6))

Coefficients:
 Estimate Std. Error z value Pr(z)
ymax  19.2881 1.7115  11.269  2.2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 

-2 log L: 60.39244 


Tom


-- 
View this message in context: 
http://www.nabble.com/Extracting-Coefficients-and-Such-from-mle2-Output-tp21770860p21770860.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Dates in Common

2009-01-23 Thread Tom La Bone

I have two collections of dates and I want to figure out what dates they have
in common. This is not giving me what I want (I don't know what it is giving
me). What is the best way to do this?

Tom

 data1
 [1] 1948-02-24 EST 1949-04-12 EST 1950-05-29 EDT 1951-05-21 EDT
 [5] 1951-12-20 EST 1953-01-22 EST 1955-02-28 EST 1956-03-08 EST
 [9] 1957-03-22 EST 1958-02-07 EST
 data2
 [1] 1948-02-24 EST 1949-04-12 EST 1950-05-29 EDT 1951-05-21 EDT
 [5] 1951-12-20 EST 1953-01-22 EST 1955-02-28 EST 1956-03-08 EST
 [9] 1957-03-22 EST 1958-02-07 EST
 intersect(data1,data2)
 [1] -689626800 -653943600 -618350400 -587505600 -569098800 -534625200
 [7] -468356400 -436042800 -403297200 -375476400
-- 
View this message in context: 
http://www.nabble.com/Dates-in-Common-tp21624909p21624909.html
Sent from the R help mailing list archive at Nabble.com.

__
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] text rather than html help in Windows

2009-01-02 Thread Tom La Bone

I would like to use Rterm in Windows XP and have the help files appear in
text format in the terminal rather than in the html popup window. For
example, I would like to enter help(lm) and get the text to appear in the
terminal window. Can anyone suggest a way to do this? Thanks and Happy Hew
Year.

Tom

-- 
View this message in context: 
http://www.nabble.com/text-rather-than-html-help-in-Windows-tp21251223p21251223.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


Re: [R] text rather than html help in Windows

2009-01-02 Thread Tom La Bone


Duncan Murdoch-2 wrote:
 
 Whoops, sorry, Uwe's advice is right.  Text help is only the default 
 when run outside a console; I use Cygwin, which doesn't look like a 
 console to R.
 

I am using eclipse with StatET to run R under Ubuntu 8.04 and Windows XP
Pro. I would like both implementations to act the same, and your suggestion
to use options(chmhelp=FALSE) in Windows did what I wanted. Uwe's suggestion
to put the option in Rprofile completed the task. Thanks.

Tom

-- 
View this message in context: 
http://www.nabble.com/text-rather-than-html-help-in-Windows-tp21251223p21251607.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Using transform to add a date column to a dataframe

2008-12-23 Thread Tom La Bone

I would like to add a column to the airquality dataset that contains the date
1950-01-01 in each row. This method does not appear to work:

 attach(airquality)
 data1 - transform(airquality,Date=as.Date(1950-01-01))

Error in data.frame(list(Ozone = c(41L, 36L, 12L, 18L, NA, 28L, 23L, 19L,  : 
  arguments imply differing number of rows: 153, 1
 
I can't decipher what the error message is trying to tell me. Any
suggestions on how to do this?


-- 
View this message in context: 
http://www.nabble.com/Using-transform-to-add-a-date-column-to-a-dataframe-tp21144414p21144414.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


Re: [R] Using transform to add a date column to a dataframe

2008-12-23 Thread Tom La Bone


Gavin Simpson wrote:
 
 
 It says that the two arguments have different numbers of observations.
 The reason for which should now be pretty obvious as you provided a
 single Date whereas airquality has 153 observations.
 


Thanks. I did look at ?transform but I was a bit confused because this
worked

   data1 - transform(airquality,LTMDA=T)

whereas this did not

  data1 - transform(airquality,Date=as.Date(1950-01-01))

Why does the first one work with one argument but the second one does not?


-- 
View this message in context: 
http://www.nabble.com/Using-transform-to-add-a-date-column-to-a-dataframe-tp21144414p21146167.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


Re: [R] Left-truncated regression

2008-12-02 Thread Tom La Bone

Look at the sand package, which is available at

   http://www.csm.ornl.gov/esh/statoed/

and the NADA package, which is available from CRAN. One or both may have
items of interest.

Tom



Zita wrote:
 
 Hi.
 
 I am looking for a function for left-truncated data.
 I have one data set with 2 variables (Hours~Yrs_Ed).
 I already left-censored the data at 200 and left-truncated it at the same
 spot, so that I am able to make 2 estimations (one for censoring and one
 for truncation).
 I know how to make the linear regression for the left-censored variable
 (hours) and how to plot the regression line into the (x,y) plot (packages
 AER, Zeileis, Survival, ...):
 
 tfit-survreg(Surv(Hours,Hours0,
 type='left')~Yrs_Ed,data=DataWomen,dist='gaussian')
 z-predict(tfit,type=response)
 plot(Yrs_Ed,Hours)
 abline(tfit)
 
 My aim is to compare the effects of truncation and censoring graphically
 by plotting the two regression lines into one plot with both datasets
 (censored and truncated).
 I just can't figure out how to write the function for left-truncated data
 and what package to use for this. I only need left-truncation, not
 left-truncation and right-censoring.
 I hope somebody can help me with that matter.
 
 Zita
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Left-truncated-regression-tp20789446p20798448.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Kolmogorov–Smirnov Test for Left Censored Data

2008-11-20 Thread Tom La Bone

Can someone recommend a package in R that will perform a two-sample
Kolmogorov–Smirnov test on left censored data? The package surv2sample
appears to offer such a test for right censored data and I guess that I can
use this package if I flip my data, but I figured I would first ask if there
was a package specific to left-censored data.

Tom


-- 
View this message in context: 
http://www.nabble.com/Kolmogorov%E2%80%93Smirnov-Test-for-Left-Censored-Data-tp20602916p20602916.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


Re: [R] Accessing Results from cenmle function in NADA package

2008-11-12 Thread Tom La Bone

This is very nice also. I am going to use this approach in the future when I
use lm. However, I can't seem to get to work the way I want with cenmle. I
will continue to experiment. Thanks folks for the suggestions.

Tom



David Winsemius wrote:
 
 
 On Nov 12, 2008, at 8:48 AM, Tom La Bone wrote:
 

 I figured it out. In case anyone else ever has this question --  
 given the
 following output from cenmle:

 fit.cen - cenmle(obs, censored, groups)
 fit.cen
   Value Std. Errorz p
 (Intercept)  1.19473 0.0772  15.4695  5.58e-54
 groups1  0.00208 0.0789   0.0263  9.79e-01
 Log(scale)  -0.40221 0.0168 -23.9034 2.82e-126

 Scale= 0.669

 Log Normal distribution
 Loglik(model)= -3908.9   Loglik(intercept only)= -3908.9
 Loglik-r:  0.0006265534

 Chisq= 0 on 1 degrees of freedom, p= 0.98
 Number of Newton-Raphson Iterations: 1
 n = 1766

 The p-value is (for example):

 p.value - summary(fit.cen)[[9]][[11]]
 
 An approach that may yield somewhat more self-documenting code would  
 be to examine either the fit object or the summary object with str and  
 then to access results by extracting named elements. Since I don't  
 have the package in question, let me use the lm object on its help  
 page as an example:
 
   ctl - c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
   trt - c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
   group - gl(2,10,20, labels=c(Ctl,Trt))
   weight - c(ctl, trt)
   lm.D9 - lm(weight ~ group)
 
   str(lm.D9)
   str(summary(lm.D9))
   summary(lm.D9)$coefficients
   summary(lm.D9)$coefficients[groupTrt, Pr(|t|)]
 
 # to get the p-value
   summary(lm.D9)$coefficients[groupTrt,Pr(|t|)]
 [1] 0.2490232
 
 You had originally asked for a method to extract coefficients and for  
 that purpose you may want to look at:
 
 ?coefficients
 
   slope - coefficients(lm.D9)[groupTrt]
   slope
 groupTrt
-0.371
 
 -- 
 David Winsemius
 Heritage Labs
 

 Tom




 Tom La Bone wrote:

 The cenmle function is used to fit two sets of censored data and  
 test if
 they are significantly different. I can print out the results of the
 analysis on the screen but can't seem to figure out how to access  
 these
 results in R and assign them to new variables, e.g., assign the slope
 calculated with cenmle to the variable m. Any suggestions?

 Tom


 -- 
 View this message in context:
 http://www.nabble.com/Accessing-Results-from-cenmle-function-in-NADA-package-tp20437420p20460676.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 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-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.
 
 

-- 
View this message in context: 
http://www.nabble.com/Accessing-Results-from-cenmle-function-in-NADA-package-tp20437420p20464040.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


Re: [R] Accessing Results from cenmle function in NADA package

2008-11-12 Thread Tom La Bone

I figured it out. In case anyone else ever has this question -- given the
following output from cenmle:

fit.cen - cenmle(obs, censored, groups)
 fit.cen
   Value Std. Errorz p
(Intercept)  1.19473 0.0772  15.4695  5.58e-54
groups1  0.00208 0.0789   0.0263  9.79e-01
Log(scale)  -0.40221 0.0168 -23.9034 2.82e-126

Scale= 0.669 

Log Normal distribution
Loglik(model)= -3908.9   Loglik(intercept only)= -3908.9 
Loglik-r:  0.0006265534 

Chisq= 0 on 1 degrees of freedom, p= 0.98 
Number of Newton-Raphson Iterations: 1 
n = 1766 

The p-value is (for example):

p.value - summary(fit.cen)[[9]][[11]]


Tom




Tom La Bone wrote:
 
 The cenmle function is used to fit two sets of censored data and test if
 they are significantly different. I can print out the results of the
 analysis on the screen but can't seem to figure out how to access these
 results in R and assign them to new variables, e.g., assign the slope
 calculated with cenmle to the variable m. Any suggestions?
 
 Tom
 

-- 
View this message in context: 
http://www.nabble.com/Accessing-Results-from-cenmle-function-in-NADA-package-tp20437420p20460676.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


Re: [R] Accessing Results from cenmle function in NADA package

2008-11-12 Thread Tom La Bone

Oh, I like your answer better than mine! Thanks.

Tom



Richard Cotton wrote:
 
 I figured it out. In case anyone else ever has this question -- given 
 the
 following output from cenmle:
 
 fit.cen - cenmle(obs, censored, groups)
  fit.cen
Value Std. Errorz p
 (Intercept)  1.19473 0.0772  15.4695  5.58e-54
 groups1  0.00208 0.0789   0.0263  9.79e-01
 Log(scale)  -0.40221 0.0168 -23.9034 2.82e-126
 
 Scale= 0.669 
 
 Log Normal distribution
 Loglik(model)= -3908.9   Loglik(intercept only)= -3908.9 
 Loglik-r:  0.0006265534 
 
 Chisq= 0 on 1 degrees of freedom, p= 0.98 
 Number of Newton-Raphson Iterations: 1 
 n = 1766 
 
 The p-value is (for example):
 
 p.value - summary(fit.cen)[[9]][[11]]
 
 Or slightly more transparently
 summary(fit.cen)$table[,'p']
 
 Regards,
 Richie.
 
 Mathematical Sciences Unit
 HSL
 
 
 
 ATTENTION:
 
 This message contains privileged and confidential inform...{{dropped:20}}
 
 __
 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.
 
 
 -
 Regards,
 Richie.
 
 Mathematical Sciences Unit
 HSL
 

-- 
View this message in context: 
http://www.nabble.com/Accessing-Results-from-cenmle-function-in-NADA-package-tp20437420p20461407.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Accessing Results from cenmle function in NADA package

2008-11-11 Thread Tom La Bone

The cenmle function is used to fit two sets of censored data and test if they
are significantly different. I can print out the results of the analysis on
the screen but can't seem to figure out how to access these results in R and
assign them to new variables, e.g., assign the slope calculated with cenmle
to the variable m. Any suggestions?

Tom
-- 
View this message in context: 
http://www.nabble.com/Accessing-Results-from-cenmle-function-in-NADA-package-tp20437420p20437420.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


Re: [R] Doing a Task Without Using a For Loop

2008-10-15 Thread Tom La Bone

I want to thank everyone for the help. I ended up having to use a loop to
assign values from the table to NinYear. However, as I have played with the
full datasets I have noticed that R is MUCH faster if I use vectors in the
loop rather than columns of a dataframe. In the specific case of 43,000
lines of data, assigning values from the table to the 43,000 elements of a
vector took 6 seconds whereas assigning values from the table to 43,000
elements of a dataframe took 21 minutes. Why is there such a huge
difference?

Tom




Tom La Bone wrote:
 
 Assume that I have the dataframe data1, which is listed at the end of
 this message. I want count the number of lines that each person has for
 each year. For example, the person with ID=213 has 15 entries (NinYear)
 for 1953. The following bit of code calculates NinYear:
 
 for (i in 1:length(data1$ID)) {
   data1$NinYear[i] - length(data1[data1$Year==data1$Year[i] 
 data1$ID==data1$ID[i],1]) }
 
 This seems to work but is horribly slow (some files I am working with have
 over 500,000 lines). Can anyone suggest a faster way of doing this,
 perhaps a way that does not use a for loop? Thanks.
 
 Tom
 
 IDYearNinYear
 209   19710
 209   19710
 213   19510
 213   19510
 213   19530
 213   19530
 213   19530
 213   19530
 213   19530
 213   19530
 213   19530
 213   19530
 213   19530
 213   19530
 213   19530
 213   19530
 213   19530
 213   19530
 213   19530
 213   19540
 213   19540
 213   19540
 213   19540
 213   19540
 213   19540
 213   19540
 213   19540
 213   19540
 213   19540
 213   19540
 213   19550
 213   19550
 234   19530
 234   19530
 234   19530
 234   19530
 234   19530
 234   19580
 234   19580
 234   19650
 234   19650
 234   19650
 249   19520
 249   19520
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Doing-a-Task-Without-Using-a-For-Loop-tp19974078p19991682.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Doing a Task Without Using a For Loop

2008-10-14 Thread Tom La Bone

Assume that I have the dataframe data1, which is listed at the end of this
message. I want count the number of lines that each person has for each
year. For example, the person with ID=213 has 15 entries (NinYear) for 1953.
The following bit of code calculates NinYear:

for (i in 1:length(data1$ID)) {
  data1$NinYear[i] - length(data1[data1$Year==data1$Year[i] 
data1$ID==data1$ID[i],1]) }

This seems to work but is horribly slow (some files I am working with have
over 500,000 lines). Can anyone suggest a faster way of doing this, perhaps
a way that does not use a for loop? Thanks.

Tom

ID  YearNinYear
209 19710
209 19710
213 19510
213 19510
213 19530
213 19530
213 19530
213 19530
213 19530
213 19530
213 19530
213 19530
213 19530
213 19530
213 19530
213 19530
213 19530
213 19530
213 19530
213 19540
213 19540
213 19540
213 19540
213 19540
213 19540
213 19540
213 19540
213 19540
213 19540
213 19540
213 19550
213 19550
234 19530
234 19530
234 19530
234 19530
234 19530
234 19580
234 19580
234 19650
234 19650
234 19650
249 19520
249 19520



-- 
View this message in context: 
http://www.nabble.com/Doing-a-Task-Without-Using-a-For-Loop-tp19974078p19974078.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


Re: [R] Doing a Task Without Using a For Loop

2008-10-14 Thread Tom La Bone

The table function, which I was unaware of, works great. However, I still
don't see how to assign the values calculated with table to data1$NinYear
without using a loop.

Tom 




Henrique Dallazuanna wrote:
 
 Try this:
 
 with(data1, table(ID, Year))
 
 On Tue, Oct 14, 2008 at 10:58 AM, Tom La Bone
 [EMAIL PROTECTED]wrote:
 

 Assume that I have the dataframe data1, which is listed at the end of
 this
 message. I want count the number of lines that each person has for each
 year. For example, the person with ID=213 has 15 entries (NinYear) for
 1953.
 The following bit of code calculates NinYear:

 for (i in 1:length(data1$ID)) {
  data1$NinYear[i] - length(data1[data1$Year==data1$Year[i] 
data1$ID==data1$ID[i],1]) }

 This seems to work but is horribly slow (some files I am working with
 have
 over 500,000 lines). Can anyone suggest a faster way of doing this,
 perhaps
 a way that does not use a for loop? Thanks.

 Tom

 ID  YearNinYear
 209 19710
 209 19710
 213 19510
 213 19510
 213 19530
 213 19530
 213 19530
 213 19530
 213 19530
 213 19530
 213 19530
 213 19530
 213 19530
 213 19530
 213 19530
 213 19530
 213 19530
 213 19530
 213 19530
 213 19540
 213 19540
 213 19540
 213 19540
 213 19540
 213 19540
 213 19540
 213 19540
 213 19540
 213 19540
 213 19540
 213 19550
 213 19550
 234 19530
 234 19530
 234 19530
 234 19530
 234 19530
 234 19580
 234 19580
 234 19650
 234 19650
 234 19650
 249 19520
 249 19520



 --
 View this message in context:
 http://www.nabble.com/Doing-a-Task-Without-Using-a-For-Loop-tp19974078p19974078.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 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.

 
 
 
 -- 
 Henrique Dallazuanna
 Curitiba-ParanĂ¡-Brasil
 25° 25' 40 S 49° 16' 22 O
 
   [[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.
 
 

-- 
View this message in context: 
http://www.nabble.com/Doing-a-Task-Without-Using-a-For-Loop-tp19974078p19975745.html
Sent from the R help mailing list archive at Nabble.com.

__
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 do I Convert 1 to the number 1?

2008-09-24 Thread Tom La Bone

Is there an elegant way in R to change a number reported as a less-than
number in text format, 1 for example, to the numeric equivalent 1? I have
been trying to use as.numeric, but have not come up with anything clever
yet.

Tom
 
-- 
View this message in context: 
http://www.nabble.com/How-do-I-Convert-%22%3C1%22-to-the-number-1--tp19651018p19651018.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Upgrade to R 2.7.2 from Debian Repository

2008-09-05 Thread Tom La Bone

I am running R 2.7.1 on an eeepc with the standard Xandros Linux. I
install/upgrade R binaries using synaptic from the
http://cran.r-project.org/bin/linux/debian/etch-cran/ repository. R 2.7.2
does not appear to be available from this repository. Will it be available
soon or is there another repository I should be using?

Tom

-- 
View this message in context: 
http://www.nabble.com/Upgrade-to-R-2.7.2-from-Debian-Repository-tp19328325p19328325.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


Re: [R] Error: can not allocate vector of 117.3 Mb

2008-09-05 Thread Tom La Bone

To see some useful discussions of this problem in various settings search
R-Help for the phrase cannot allocate vector of size.

Tom



ram basnet wrote:
 
 Hi R users,
  
 I am doing multiscale bootstrapping for clustering through pvclust
 package. I have large data set (observations 182 and variables 5546). When
 i tried to make bootstrapping, then i got message as Bootstrap (r =
 0.5)Error: cannot allocate vector of size 117.3 Mb.
 I am new R user and could not understand what is the problem and also
 don't know the easiet solution.
 If someone knows, pls help me.
 Thanks in advance.
  
 Ram Kumar Basnet
 Graduate student.
 
 
   
   [[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.
 
 

-- 
View this message in context: 
http://www.nabble.com/Error%3A-can-not-allocate-vector-of-117.3-Mb-tp19330258p19331629.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


Re: [R] How Can I Tell if the R Running is 64 bit or 32 bit?

2008-08-08 Thread Tom La Bone

Well, I am indeed running 64-bit Ubuntu and 64-bit R. Thanks!

Tom



Peter Dalgaard wrote:
 
 Marc Schwartz wrote:
 Try:

  8*4
 [1] 32

 As per the help page for .Machine:

   sizeof.pointer the number of *bytes* in a C SEXP type.

 So:

   8 bits per byte * 4 bytes = 32 bits

 Also (outside of R) type uname -a. This should give something like
 
 Linux viggo 2.6.18.8-0.10-default #1 SMP Wed Jun 4 15:46:34 UTC 2008 
 x86_64 x86_64 x86_64 GNU/Linux
 
 on a 64-bit system (SUSE in this case)
 
 but
 
 Linux turmalin 2.6.22.18-0.2-default #1 SMP 2008-06-09 13:53:20 +0200 
 i686 i686 i386 GNU/Linux
 
 on 32-bitters

 :-)

 HTH,

 Marc Schwartz


 on 08/08/2008 03:58 PM milton ruser wrote:
 Dear Prof. B.Ripley,

 If :
 .Machine$sizeof.pointer
 [1] 4
 2*2*2*2
 [1] 16

 So I am running with 16 bits?

 How can I know the number of bits supported on my machine?

 Kindly,

 miltinho astronauta
 brazil

 On 8/8/08, Prof Brian Ripley [EMAIL PROTECTED] wrote:
 Look at .Machine$sizeof.pointer (in bytes).

 On Fri, 8 Aug 2008, Tom La Bone wrote:


 I think I installed 64-bit Ubuntu 8.04 and 64-bit R on my computer. I
 can't
 seem to find anything that says this is 64-bit Ubuntu or this is 
 64-bit
 R. How do I tell what version of R I am running?

 Tom

 __
 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.
 
 
 -- 
O__   Peter Dalgaard Ă˜ster Farimagsgade 5, Entr.B
   c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
  (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
 ~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907
 
 __
 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.
 
 

-- 
View this message in context: 
http://www.nabble.com/How-Can-I-Tell-if-the-R-Running-is-64-bit-or-32-bit--tp18898653p1889.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Will This Computer Run 64 bit Ubuntu/R?

2008-08-03 Thread Tom La Bone

After doing some reading about 64-bit systems and software I am still
somewhat uncertain about some things. I have a Dell Dimension XPS 400 with a
dual core Intel Pentium D 940 (3.2 GHz) and 4 Gb of memory. I currently dual
boot the system with XP Professional and Ubuntu 8.04 (32 bit). If I simply
install Ubuntu 8.04 (64 bit) on this system will it run the 64 bit linux
version of R? I would appreciate any advice you might be willing to offer on
this.

Tom



-- 
View this message in context: 
http://www.nabble.com/Will-This-Computer-Run-64-bit-Ubuntu-R--tp18799376p18799376.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Memory Problems with a Simple Bootstrap - Part II

2008-08-02 Thread Tom La Bone

I have distilled my bootstrap problem down to this bit of code, which
calculates an estimate of the 95th percentile of 7500 random numbers drawn
from a standard normal distribution: 

library(boot)
per95 - function( annual.data, b.index) {
  sample.data - annual.data[b.index]
  return(quantile(sample.data,probs=c(0.95))) }
m - 1
x - rnorm(7500,0,1)
B - boot(data=x,statistic=per95,R=m)

Error: cannot allocate vector of size 286.1 Mb

This was result was observed with R 2.7.1 and 2.7.1patched when run on a
Windows XP computer with 4Gb of memory.

This does not seem to be an excessively large and complicated calculation,
so is this an intentional limitation of the boot function, a result of bad
choices on my part, or a bug? 

Tom





-- 
View this message in context: 
http://www.nabble.com/Memory-Problems-with-a-Simple-Bootstrap---Part-II-tp18788083p18788083.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Memory Problems with a Simple Bootstrap

2008-08-01 Thread Tom La Bone


I have a data file called inputdata.csv that looks something like this

  ID YearResult Month   Date
1   71741954   103  540301
2   7174195443  540322
3   20924  1967 4   2  670223
4   20924  1967   -75  670518
5   20924  1967   -37  670706
...
67209 ...

i.e., it goes on for 67209 rows (~2 Mb file). When I run the following
bootstrap session I get the indicated error:

 
 library(boot)
 setwd(C:/Documents and Settings/Tom/Desktop)   
 
 data.in - read.csv(inputdata.csv,header=T,as.is=T)
 
 per95 - function( annual.data, b.index) {
+   sample.data - annual.data[b.index,]
+   return(quantile(sample.data$Result,probs=c(0.95))) }
 
 m - 1
 for (i in 1:39) {
+   annual.data - data.in[data.in$Year == (i+1949),]
+   B - boot(data=annual.data,statistic=per95,R=m)
+   print(i)
+   print(memory.size())
+ }
[1] 1
[1] 20.26163
[1] 2
[1] 61.6352
[1] 3
[1] 134.4187
[1] 4
[1] 149.4704
[1] 5
[1] 290.3090
[1] 6
[1] 376.7017
[1] 7
[1] 435.7683
[1] 8
[1] 463.7404
[1] 9
[1] 497.7946
Error: cannot allocate vector of size 568.8 Mb
 

I am running this on a Windows XP Pro machine with 4 Gb of memory. The same
problem occurs when the code is executed on the same box running Ubuntu
8.04. Does anyone see any obvious reason why this should run out of memory?
I would be happy to email the data file to anyone who cares to try it on
their computer.

Tom


 


-- 
View this message in context: 
http://www.nabble.com/Memory-Problems-with-a-Simple-Bootstrap-tp18777897p18777897.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


Re: [R] Memory Problems with a Simple Bootstrap

2008-08-01 Thread Tom La Bone

Same problem. The Windows Task Manager indicated that Rgui.exe was using
1,249,722 K of memory when the error occurred. This is R 2.7.1 by the way.

 library(boot)
 setwd(C:/Documents and Settings/Tom/Desktop)   
 
 data.in - read.csv(inputdata.csv,header=T,as.is=T)
 
 per95 - function( annual.data, b.index) {
+   sample.data - annual.data[b.index,]
+   return(quantile(sample.data$Result,probs=c(0.95))) }
 
 m - 1
 for (i in 1:39) {
+   annual.data - data.in[data.in$Year == (i+1949),]
+   B - boot(data=annual.data,statistic=per95,R=m)
+   gc()
+   print(i)  
+   print(object.size(B))
+   print(memory.size())
+ }
[1] 1
[1] 90352
[1] 12.35335
[1] 2
[1] 111032
[1] 12.39024
[1] 3
[1] 155544
[1] 12.48451
[1] 4
[1] 159064
[1] 11.10526
[1] 5
[1] 243456
[1] 11.23505
[1] 6
[1] 280592
[1] 12.74642
[1] 7
[1] 302416
[1] 11.33087
[1] 8
[1] 319752
[1] 12.84377
[1] 9
[1] 351448
[1] 11.42264
Error: cannot allocate vector of size 284.4 Mb
 
 



jholtman wrote:
 
 Use gc() in the loop to possibly free up any fragmented memory.  You
 might also print out the size of B (object.size(B)) since that appears
 to be the only variable in your loop that might be growing.
 
 On Fri, Aug 1, 2008 at 12:09 PM, Tom La Bone [EMAIL PROTECTED]
 wrote:


 I have a data file called inputdata.csv that looks something like this

  ID YearResult Month   Date
 1   71741954   103  540301
 2   7174195443  540322
 3   20924  1967 4   2  670223
 4   20924  1967   -75  670518
 5   20924  1967   -37  670706
 ...
 67209 ...

 i.e., it goes on for 67209 rows (~2 Mb file). When I run the following
 bootstrap session I get the indicated error:


 library(boot)
 setwd(C:/Documents and Settings/Tom/Desktop)

 data.in - read.csv(inputdata.csv,header=T,as.is=T)

 per95 - function( annual.data, b.index) {
 +   sample.data - annual.data[b.index,]
 +   return(quantile(sample.data$Result,probs=c(0.95))) }

 m - 1
 for (i in 1:39) {
 +   annual.data - data.in[data.in$Year == (i+1949),]
 +   B - boot(data=annual.data,statistic=per95,R=m)
 +   print(i)
 +   print(memory.size())
 + }
 [1] 1
 [1] 20.26163
 [1] 2
 [1] 61.6352
 [1] 3
 [1] 134.4187
 [1] 4
 [1] 149.4704
 [1] 5
 [1] 290.3090
 [1] 6
 [1] 376.7017
 [1] 7
 [1] 435.7683
 [1] 8
 [1] 463.7404
 [1] 9
 [1] 497.7946
 Error: cannot allocate vector of size 568.8 Mb


 I am running this on a Windows XP Pro machine with 4 Gb of memory. The
 same
 problem occurs when the code is executed on the same box running Ubuntu
 8.04. Does anyone see any obvious reason why this should run out of
 memory?
 I would be happy to email the data file to anyone who cares to try it on
 their computer.

 Tom





 --
 View this message in context:
 http://www.nabble.com/Memory-Problems-with-a-Simple-Bootstrap-tp18777897p18777897.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 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.

 
 
 
 -- 
 Jim Holtman
 Cincinnati, OH
 +1 513 646 9390
 
 What is the problem that you are trying to solve?
 
 __
 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.
 
 

-- 
View this message in context: 
http://www.nabble.com/Memory-Problems-with-a-Simple-Bootstrap-tp18777897p18779433.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


Re: [R] Memory Problems with a Simple Bootstrap

2008-08-01 Thread Tom La Bone

Here it is with the gc() in a print statement.

Tom

 
 library(boot)
 setwd(C:/Documents and Settings/Tom/Desktop)   
 
 data.in - read.csv(inputdata.csv,header=T,as.is=T)
 
 per95 - function( annual.data, b.index) {
+   sample.data - annual.data[b.index,]
+   return(quantile(sample.data$Result,probs=c(0.95))) }
 
 m - 1
 for (i in 1:39) {
+   annual.data - data.in[data.in$Year == (i+1949),]
+   B - boot(data=annual.data,statistic=per95,R=m)
+   print(i)  
+   print(gc())  
+   print(object.size(B))
+   print(memory.size())
+ }
[1] 1
 used (Mb) gc trigger (Mb) max used (Mb)
Ncells 145517  3.9 35  9.4   35  9.4
Vcells 304805  2.42602013 19.9  2841664 21.7
[1] 90352
[1] 12.35812
[1] 2
 used (Mb) gc trigger (Mb) max used  (Mb)
Ncells 145540  3.9 35  9.4   35   9.4
Vcells 309041  2.4   12977679 99.1 15259760 116.5
[1] 111032
[1] 12.39814
[1] 3
 used (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 145540  3.9 35   9.4   35   9.4
Vcells 318147  2.5   35277418 269.2 41833896 319.2
[1] 155544
[1] 12.49432
[1] 4
 used (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 145540  3.9 35   9.4   35   9.4
Vcells 318867  2.5   37046714 282.7 43935337 335.3
[1] 159064
[1] 11.10362
[1] 5
 used (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 145540  3.9 35   9.4   35   9.4
Vcells 336129  2.6   79348305 605.4 94192718 718.7
[1] 243456
[1] 11.2296
[1] 6
 used (Mb) gc trigger  (Mb)  max used  (Mb)
Ncells 145540  3.9 35   9.435   9.4
Vcells 343725  2.7   97971904 747.5 116530118 889.1
[1] 280592
[1] 12.75431
[1] 7
 used (Mb) gc trigger  (Mb)  max used  (Mb)
Ncells 145540  3.9 35   9.435   9.4
Vcells 348189  2.7  108915204 831.0 129493067 988.0
[1] 302416
[1] 11.32924
[1] 8
 used (Mb) gc trigger  (Mb)  max used   (Mb)
Ncells 145540  3.9 35   9.4359.4
Vcells 351735  2.7  117607222 897.3 139706454 1065.9
[1] 319752
[1] 12.85929
[1] 9
 used (Mb) gc trigger   (Mb)  max used   (Mb)
Ncells 145540  3.9 359.4359.4
Vcells 358217  2.8  133510676 1018.7 158462984 1209.0
[1] 351448
[1] 11.40765
Error: cannot allocate vector of size 284.4 Mb
 
 
 




jholtman wrote:
 
 It seems like the objects are reasonable size and the memory size also
 seems reasonable.  That is what I usually go by to see if there are
 large objects in my memory.  If it was showing that R had 1.2GB of
 memory allocated to it, I wonder if there might be a memory leak
 somewhere.
 
 On Fri, Aug 1, 2008 at 1:36 PM, Tom La Bone [EMAIL PROTECTED]
 wrote:

 Same problem. The Windows Task Manager indicated that Rgui.exe was using
 1,249,722 K of memory when the error occurred. This is R 2.7.1 by the
 way.

 library(boot)
 setwd(C:/Documents and Settings/Tom/Desktop)

 data.in - read.csv(inputdata.csv,header=T,as.is=T)

 per95 - function( annual.data, b.index) {
 +   sample.data - annual.data[b.index,]
 +   return(quantile(sample.data$Result,probs=c(0.95))) }

 m - 1
 for (i in 1:39) {
 +   annual.data - data.in[data.in$Year == (i+1949),]
 +   B - boot(data=annual.data,statistic=per95,R=m)
 +   gc()
 +   print(i)
 +   print(object.size(B))
 +   print(memory.size())
 + }
 [1] 1
 [1] 90352
 [1] 12.35335
 [1] 2
 [1] 111032
 [1] 12.39024
 [1] 3
 [1] 155544
 [1] 12.48451
 [1] 4
 [1] 159064
 [1] 11.10526
 [1] 5
 [1] 243456
 [1] 11.23505
 [1] 6
 [1] 280592
 [1] 12.74642
 [1] 7
 [1] 302416
 [1] 11.33087
 [1] 8
 [1] 319752
 [1] 12.84377
 [1] 9
 [1] 351448
 [1] 11.42264
 Error: cannot allocate vector of size 284.4 Mb





 jholtman wrote:

 Use gc() in the loop to possibly free up any fragmented memory.  You
 might also print out the size of B (object.size(B)) since that appears
 to be the only variable in your loop that might be growing.

 On Fri, Aug 1, 2008 at 12:09 PM, Tom La Bone [EMAIL PROTECTED]
 wrote:


 I have a data file called inputdata.csv that looks something like this

  ID YearResult Month   Date
 1   71741954   103  540301
 2   7174195443  540322
 3   20924  1967 4   2  670223
 4   20924  1967   -75  670518
 5   20924  1967   -37  670706
 ...
 67209 ...

 i.e., it goes on for 67209 rows (~2 Mb file). When I run the following
 bootstrap session I get the indicated error:


 library(boot)
 setwd(C:/Documents and Settings/Tom/Desktop)

 data.in - read.csv(inputdata.csv,header=T,as.is=T)

 per95 - function( annual.data, b.index) {
 +   sample.data - annual.data[b.index,]
 +   return(quantile(sample.data$Result,probs=c(0.95))) }

 m - 1
 for (i in 1:39) {
 +   annual.data - data.in[data.in$Year == (i+1949),]
 +   B - boot(data=annual.data,statistic=per95,R=m)
 +   print(i)
 +   print(memory.size())
 + }
 [1] 1
 [1] 20.26163
 [1] 2
 [1] 61.6352
 [1] 3
 [1] 134.4187
 [1] 4
 [1] 149.4704
 [1] 5
 [1] 290.3090
 [1] 6
 [1

Re: [R] re sponse surface analysis

2008-07-27 Thread Tom La Bone

There appears to be a very promising response surface package being discussed
at useR-2008, but I have been unable to find the package on CRAN or contact
the authors.

www.statistik.uni-dortmund.de/useR-2008/abstracts/Sztendur+Diamond.pdf


Tom




Jinsong Zhao wrote:
 
 Hi,
 
 Is there a package that could do response surface analysis equivalent to
 SAS RSREG procedure? Thanks!
 
 Regards,
 
 Jinsong
 
 __
 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.
 
 

-- 
View this message in context: 
http://www.nabble.com/response-surface-analysis-tp18666106p18675308.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Tutorial on rgl Graphics

2008-07-25 Thread Tom La Bone

Can anyone point me towards a tutorial on using the rgl graphics package?
Something with lots of examples would be nice. Thanks.

Tom

-- 
View this message in context: 
http://www.nabble.com/Tutorial-on-rgl-Graphics-tp18649114p18649114.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


Re: [R] Tutorial on rgl Graphics

2008-07-25 Thread Tom La Bone

After looking around a bit more I found the example I was looking for --
plotlm3d, which I found on the R wiki

 http://wiki.r-project.org/rwiki/doku.php?id=graph_gallery:new-graphics

The original author was John Fox, and it was modified by Jose Claudio Faria
and Duncan Murdoch. Below is a simplified version of the function and two
examples. One example was presented as a test of the function and it works
fine. The second example is the plot I want to make and I can't seem to get
the scale on the x and y axes correct. Being unfamiliar with rgl, can
someone provide a hint on how to get the scales right? Thanks for the help.

Tom



plotlm3d - function (x, y, z,
  surface= T,
  model  = 'z ~ x + y',
  simple.axes= T,
  box= F,
  xlab   = deparse(substitute(x)),
  ylab   = deparse(substitute(y)),
  zlab   = deparse(substitute(z)),
  surface.col= c('blue', 'orange', 'red', 'green',
 'magenta', 'cyan', 'yellow',
'gray', 'brown'),
  point.col  = 'yellow',
  grid.col   = material3d(color),
  grid   = T,
  grid.lines = 26,
  sphere.factor  = 1,
  threshold  = 0.01)
{
  require(rgl)
  require(mgcv)
  xlab; ylab; zlab
  size - max(c(x,y,z))/100 * sphere.factor
  if (size  threshold)
spheres3d(x, y, z, color = point.col, radius = size)
  else
points3d(x, y, z, color = point.col)
  aspect3d(c(1, 1, 1))
  if (surface) {
xvals - seq(min(x), max(x), length = grid.lines)
yvals - seq(min(y), max(y), length = grid.lines)
dat  - expand.grid(x = xvals, y = yvals)
for (i in 1:length(model)) {
  mod - lm(formula(model[i]))
  zhat - matrix(predict(mod, newdata = dat), grid.lines, grid.lines)
  surface3d(xvals, yvals, zhat, color = surface.col[i], alpha = 0.5, lit
= F)
  if (grid)
surface3d(xvals, yvals, zhat, color = grid.col, alpha = 0.5,
lit = F, front = 'lines', back = 'lines') }}
  if(simple.axes) {
axes3d(c('x', 'y', 'z'))
title3d(xlab = xlab, ylab = ylab, zlab = zlab)
  }
  else
decorate3d(xlab = xlab, ylab = ylab, zlab = zlab, box = box)
}

#This is an example of a 3D scatterplot that works fine
x - c( 274,  180,  375,  205,   86,  265,   98,  330,  195,   53,
   430,  372,  236,  157,  370)
y - c(2450, 3254, 3802, 2838, 2347, 3782, 3008, 2450, 2137, 2560,
  4020, 4427, 2660, 2088, 2605)
z - c( 162,  120,  223,  131,   67,  169,   81,  192,  116,   55,
   252,  232,  144,  103,  212)
open3d()
plotlm3d(x, y, z,
 surface = T,
 model   = 'z ~ x + y',
 xlab= 'x',
 ylab= 'y',
 zlab= 'z')

#This is the plot I am trying to make - scales on x and y axes are wrong
x - c(0.3405,0.1220,0.1028,0.08451,0.05668,0.0345,0.003788,0.002121)
y - c(0.3460,0.1227,0.1097,0.09666,0.07677,0.06278,0.02168,0.01303)
z - c(2720,1150,1010,790,482,358,78,35)
open3d()
plotlm3d(x, y, z,
 surface = T,
 model   = 'z ~ x + y - 1',
 xlab= 'x',
 ylab= 'y',
 zlab= 'z')



-- 
View this message in context: 
http://www.nabble.com/Tutorial-on-rgl-Graphics-tp18649114p18653442.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Problem with scatterplot3d example

2008-07-24 Thread Tom La Bone

I tried to run the following example from section 4.1.4 of the Scatterplot3d
-
an R package for Visualizing Multivariate Data vignette and got an error on
the part that plots the regression plane:

 library(scatterplot3d)
 data(trees)
 s3d - scatterplot3d(trees, type = h, color = blue,
+ angle = 55, scale.y = 0.7, pch = 16, main = Adding elements)
 my.lm - lm(trees$Volume ~ trees$Girth + trees$Height)
 s3d$plain3d(my.lm)

Error: attempt to apply non-function

 s3d$points3d(seq(10, 20, 2), seq(85, 60, -5), seq(60, 10, -10),
+ col = red, type = h, pch = 8)

Any ideas on what I need to change in order to get the plane to plot?

Tom



-- 
View this message in context: 
http://www.nabble.com/Problem-with-scatterplot3d-example-tp18630468p18630468.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Backgrounds in Multiple Plots made with fig

2008-07-06 Thread Tom La Bone

The following code was adapted from an example Vincent Zoonekynd gave on his
web site http://zoonek2.free.fr/UNIX/48_R/03.html:

n - 1000
x - rnorm(n)
qqnorm(x)
qqline(x, col=red)
op - par(fig=c(.02,.5,.5,.98), new=TRUE)
hist(x, probability=T,
 col=light blue, xlab=, ylab=, main=, axes=F)
lines(density(x), col=red, lwd=2)
box()
par(op)

How can I make the background in the small box in the upper left-hand corner
be a different color than the background in the main plot and erase any of
the main plot that happens to be behind the box?

Tom
 



-- 
View this message in context: 
http://www.nabble.com/Backgrounds-in-Multiple-Plots-made-with-%22fig%22-tp18302602p18302602.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


Re: [R] Deming Regression

2008-06-18 Thread Tom La Bone

I believe that Deming regression also goes by the name of orthogonal
regression, which can be performed in R using pca methods. If you do a
search of the list for orthogonal regression you can see the previous
discussions of this topic.

Tom


Dexter Riley wrote:
 
 Hi all.  Has anyone ever done a Deming Regression in R?  I'm wondering if
 there's a simple way to do it.
 Thanks for all your help!
 -Ed
 

-- 
View this message in context: 
http://www.nabble.com/Deming-Regression-tp17949318p17981875.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Simultaneous Confidence/Prediction Bands

2008-06-17 Thread Tom La Bone

Is there a built-in function in R that will generate simultaneous confidence
and prediction bands for linear regression?

Tom
-- 
View this message in context: 
http://www.nabble.com/Simultaneous-Confidence-Prediction-Bands-tp17941537p17941537.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


Re: [R] R on an ASUS eee PC, continued - installing packages

2008-06-16 Thread Tom La Bone

I am running R in the konsole of the Kate editor on an eeePC 900 (standard
Xandros OS). When a plot is generated it is initially too large to fit in
the screen, but if I click on the plot it automatically resizes to fit
properly. I have no idea if this is a default behavior.

Tom




Millo Giovanni wrote:
 
 Dear all, 
 
 I just went through the process of installing R on an eeePC 900 running
 Linux. As a Windows useR utterly ignorant about Linux, I'd never have
 done it without reading your posts and the R Wiki, so first of all:
 thank you! 
 Next, taking up your thread from some weeks ago, I thought this could be
 useful for somebody else too, so here's what I did:
 
 1) I followed wolfgang's step-by-step guide at
 http://finzi.psych.upenn.edu/R/Rhelp02a/archive/128565.html,
 plus 
 2) I installed the build dependencies as shown in R Wiki:
 
 ## quoting from
 http://wiki.r-project.org/rwiki/doku.php?id=getting-started:installation
 :debian#build_r ##
 How much supporting software you need to install depends on how much
 compilation you want to be able to do with R. If you just want to be
 able to run R, you can get r-base-core and all the recommended packages
 by doing: 
 
 sudo apt-get install r-base
 
 If you want to be able to build and install R packages (including those
 from CRAN), you can get all the common header files, as well as
 r-base-core by doing: 
 
 sudo apt-get install r-base-dev
 
 If you want to be able to build R from its source code, you can get
 build dependencies for R (e.g., compilers, header files) by doing: 
 
 sudo apt-get build-dep r-base
 ## end quote ##
 
 This way I got all the necessary compilers, headers etc. automagically
 installed as well, so that install.packages() works fine now: I
 installed the whole Econometrics task view without problems. I still
 haven't tried to install Rmetrics in order to save space on the little
 machine, because I do not currently need it, but it should go the same
 way: maybe this can solve John's problem?
 
 I am aware that probably removing the original OS and installing Debian
 as suggested by Dirk Eddelbuettel here
 http://finzi.psych.upenn.edu/R/Rhelp02a/archive/128605.html would be a
 better solution, but I am a complete Linux newbie, never ever tried it
 before, so it's good both for me and for family use to retain the
 original easy mode GUI while having R running on the same machine.
 Full desktop mode (=standard KDE) is also easily enabled by adding
 kicker and ksmserver (see http://wiki.eeeuser.com/howto:getkde, I did it
 the manual way and it worked; just take heed that kicker and ksmserver
 were not found in the '900's repository and I had to take them from the
 '701's).
 
 The only thing I wish I were able to do now is to have the graphics
 windows defaults changed to a size fitting the small 9'' screen, as now
 I have to reduce it and move it to the right by hand every time to
 reproduce the results of 'windowstile in Windows. If anybody can
 help...
 
 HTH,
 Giovanni
 
 Giovanni Millo
 Research Dept.,
 Assicurazioni Generali SpA
 Via Machiavelli 4, 
 34131 Trieste (Italy)
 tel. +39 040 671184 
 fax  +39 040 671160 
 
 # original message: 
 From: John C Frain frainj 
 Date: Mon, 28 Apr 2008 15:33:31 +0100
 
 Thanks for the step by step guide. It installs a base R and some 
 libraries very well. I tries to load some of the Rmetrics libraries, 
 using install.packages() nu ran into problems. I used apt-get install 
 to install make and gcc from the Xandros repository. gcc also included 
 binutils, gcc-4.1 and libsspo. Is there an easy answer to the 
 question what I need to install to get the install process working. 
 The R Installation and Administration guide says that I just need the 
 compilers and tools. Installing robustbase gives the following 
 messages. (If it is as simple as R not being able to find the header 
 files how do I tell R where to find them?). 
 
 
 Best Regards 
 
 
 John 
 
 output in original message suppressed
 
 -- 
 John C Frain
 Trinity College Dublin
 Dublin 2
 Ireland
 www.tcd.ie/Economics/staff/frainj/home.html
 mailto:frainj at tcd.ie
 mailto:frainj at gmail.com
  
 Ai sensi del D.Lgs. 196/2003 si precisa che le informazi...{{dropped:13}}
 
 __
 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.
 
 

-- 
View this message in context: 
http://www.nabble.com/R-on-an-ASUS-eee-PC%2C-continued---installing-packages-tp17862000p17862223.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Units of Difference Between Two Dates

2008-05-15 Thread Tom La Bone

I would like all three of these calculations to give an answer in days (or at
least the same units):

 as.POSIXct(1971-08-01 00:00:00) - as.POSIXct(1971-08-01 00:00:00)
Time difference of 0 secs
 
 as.POSIXct(1971-08-01 12:00:00) - as.POSIXct(1971-08-01 00:00:00)
Time difference of 12 hours
 
 as.POSIXct(1971-09-01 00:00:00) - as.POSIXct(1971-08-01 00:00:00)
Time difference of 31 days
 

What is the best way to do this?

Tom

-- 
View this message in context: 
http://www.nabble.com/Units-of-Difference-Between-Two-Dates-tp17251994p17251994.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Statistical Methods and Software for the Analysis of Occupational Exposure Data With Non-Detectable Values

2008-04-29 Thread Tom La Bone

FYI

This is a nice package that is not on CRAN for some reason. You can get it
at

http://www.csm.ornl.gov/esh/statoed/

Tom
-- 
View this message in context: 
http://www.nabble.com/Statistical-Methods-and-Software-for-the-Analysis-of-Occupational-Exposure-Data-With-Non-Detectable-Values-tp16966228p16966228.html
Sent from the R help mailing list archive at Nabble.com.

__
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] ARAR Time Series Analysis in R

2008-04-16 Thread Tom La Bone

Does R have a function for doing an ARAR analysis of a time series?

Tom
-- 
View this message in context: 
http://www.nabble.com/ARAR-Time-Series-Analysis-in-R-tp16722577p16722577.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


Re: [R] Specifying relative position of text in a plot

2008-03-13 Thread Tom La Bone

Thanks for all of the suggestions. The key key here seems to be using the
par function to change the coordinate system like so 

plot(rnorm(100), rnorm(100))
op - par(usr)
par(usr = c(0, 1, 0, 1))
text(0.5,0.5,TEST)
par(usr = op)

Prof Ripley commented that this approach will also work on log plots, but I
don't think I completely understand what is going on because this does not
work for me

plot(rlnorm(100), rlnorm(100),log=xy)
op - par(usr)
par(usr = c(0, 1, 0, 1))
text(0.5,0.5,TEST)
par(usr = op)

Any hints on what I am doing wrong with the log plots? Thanks again for the
help.

Tom


-- 
View this message in context: 
http://www.nabble.com/Specifying-relative-position-of-text-in-a-plot-tp16002549p16024549.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Specifying relative position of text in a plot

2008-03-12 Thread Tom La Bone

What is the simplest way to specify the location of text in a scatter plot
(created using the plot function) in relative terms rather than specific x-y
coordinates? For example, rather than putting text at (300,49) on a plot,
how do I put it 1/10 of the way over from the y axis and 1/2 of the way up
from the x axis? Thanks.

Tom 
-- 
View this message in context: 
http://www.nabble.com/Specifying-relative-position-of-text-in-a-plot-tp16002549p16002549.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


Re: [R] I need to buy a book in R

2008-03-03 Thread Tom La Bone

This is a nice list:

http://www.amazon.com/Use-R/lm/RNFBA3UHW2M73/ref=cm_lmt_srch_f_1_rsrsrs0

Tom



kayj wrote:
 
 Hi All,
 
  I am a new user in R and I would like to buy a book that teaches me how
 to use R. In addition, I may nees to do some advanced statistical
 analysis. Does anyone recommend some books or websites where I can learn
 R. 
 
 
 Thanks   
 

-- 
View this message in context: 
http://www.nabble.com/I-need-to-buy-a-book-in-R-tp15811699p15818270.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


Re: [R] best text editor for Linux?

2008-02-02 Thread Tom La Bone

I am in a similar situation and found that Kate combined with Konsole
operates very much like Tinn-R. I actually use Kate for all interpreters
like Python, R, and Octave under linux.

Tom




Wade Wall wrote:
 
 Hi all,
 
 I know this question has been asked in the past, but I am wondering if
 anyone running R on Linux has any guidance as to a text editor that works
 well with R.  At the present time I am running R on Windows and using
 TINN-R.  For a number of reasons I want to switch to Linux, but can't find
 much in the way of a text editor in sync with R.  Any experiences,
 recommendations would be appreciated.
 
 Wade Wall
 
   [[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.
 
 

-- 
View this message in context: 
http://www.nabble.com/best-text-editor-for-Linux--tp15239201p15242799.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Meaning of Error Message from decompose

2008-02-02 Thread Tom La Bone
Greetings,

 

For the following quarterly data I did a classical decomposition by hand in
a spreadsheet and got reasonably similar results using Minitab 15. 

 

x

1  36

2  44

3  45

4  106

5  38

6  46

7  47

8  112

9  42

10 49

11 48

12 118

13 42

14 50

15 51

16 118

 

Trying my luck with R, I tried to use the decompose function but it gives me
the following:

 

Error in decompose(data.t) : time series has no or less than 3 periods

 

data.t is indeed a time series (is.ts returns true) and when I plot data.t
it looks like a times series.  Any suggestions on how to use decompose here
(if it is the right function)?  Thanks.

 

Tom

 


[[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.


Re: [R] Problems with EMACS-ESS on Ubuntu

2007-12-25 Thread Tom La Bone

Yes indeed. As usual, I found the answer to my question shortly after I
posted it to the forum. John Fox clearly describes this behavior in his
paper An Introduction to ESS + XEmacs for Windows Users of R. I guess I
was confused because the version of Emacs/ESS I installed on Windows
(courtesy of Vincent Goulet) did not require me to confirm that I wanted to
use R. Thanks everyone for the assistance.

Tom



Ben Bolker wrote:
 
 Tom La Bone booboo at gforcecable.com writes:
 
 
 
 I installed EMACS-ESS on Windows XP-Pro and it worked with R perfectly
 right
 out of the box. I was impressed with how easy it is to use (I normally
 use
 Tinn-R). I then switched over to Ubuntu 7.10 and installed EMACS-ESS.
 Everything worked the same as in Windows (which is my main reason for
 using
 EMACS) until I tried to send a line of code from the EMACS buffer to R --
 R
 is running but the code just will not go to it. All I get is a line at
 the
 bottom of the editor window that says Process to load into: R. I am new
 to
 EMACS and did not see any fixes that looked promising in the ESS manual.
 Can
 anyone offer some suggestions on things to check? Thanks.
 
   Emacs just wants you to confirm which buffer the code is getting
 sent to (and the buffer called R is its default).  The focus should
 automatically have gotten set to the mini-buffer at the bottom of the
 window, so if you just hit ENTER in response to this query everything
 should work fine!
 
   Ben Bolker
 
 __
 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.
 
 

-- 
View this message in context: 
http://www.nabble.com/Problems-with-EMACS-ESS-on-Ubuntu-tp14492497p14497587.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


Re: [R] The R Book - great resource for R beginners

2007-11-29 Thread Tom La Bone

IMHO The R Book is far better than indicated in that review and should be
near the top of the list for beginners looking for a manual for R.

Tom


Katharine Mullen wrote:
 
 It was reviewed in the most recent R News
 (http://www.r-project.org/doc/Rnews/Rnews_2007-2.pdf).
 
 On Thu, 29 Nov 2007, Robert Harris wrote:
 
 Hi all,

 I've recently discovered The R Book by Micheal J. Crawley. I am new to
 R and I am finding it incredibly useful.

 With my background in math and programming, I expected that I would be
 able to pick it up quickly, but even after reading several other intro
 books, I found it was still hard to figure out how to get data into R and
 how dataframes relate to vectors and actually doing statistics with R.

 But, The R Book is well written and gives plenty of examples and explains
 many of the often used tools within R. It's both a tutorial and a
 relatively advanced reference book for R, very accessible to a beginner
 like me.

 Just curious: What have been the experiences of others who have used The
 R Book?

 Thanks,

 Bob Harris



 -

  [[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-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.
 
 

-- 
View this message in context: 
http://www.nabble.com/Recommended-textbooks-for-R--tf4895638.html#a14039487
Sent from the R help mailing list archive at Nabble.com.

__
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] Linear Regression with lm Forcing the Slope to Equal 1

2007-11-17 Thread Tom La Bone

Is there a way to do a linear regression with lm (having one predictor
variable) and constrain the slope of the line to equal 1?

Tom 
-- 
View this message in context: 
http://www.nabble.com/Linear-Regression-with-lm-Forcing-the-Slope-to-Equal-1-tf4828804.html#a13815432
Sent from the R help mailing list archive at Nabble.com.

__
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] Bootstrap CI of Slope in a Weighted Simple Linear Regression

2007-11-05 Thread Tom La Bone

Greetings,

I would like to use the boot function to generate a bootstrap confidence
interval for the slope in a SLR that has a zero intercept. My attempt to do
this is shown below. Is this the correct implementation of the boot function
to solve this problem? In particular, should I be doing anything with the
residuals in the bs function (e.g., using weighted residuals)? Thanks for
the help.

X - c(0.875691867,0.871198003,0.814833892,0.788439976,0.738949275,
0.662589259,0.625487458,0.596570413,0.573693499,0.541569432,0.490628528,
0.440835275,0.397729163,0.358838088,0.323749892,0.24980067,0.213632079,
0.159989195,0.127709133,0.109218152,0.104276109,0.086467125,0.075718558,
0.059271067,0.05441905,0.049097803,0.044388138,0.014282204,0.004744354)

Y -
c(1.710091172,1.719901584,1.677683515,1.586374357,1.492977191,1.327498848,
1.301327304,1.25174086,1.149220115,1.130543366,0.974774745,0.912550499,0.752369319,
0.745150543,0.639280298,0.478799628,0.433639966,0.346051447,0.280818024,0.230285038,
0.201046915,0.179974417,0.163766453,0.102048289,0.75621,0.100711353,0.072401066,
0.023761328,0.013927331)

W - 1/X

fit - lm(Y ~ X - 1,weights=W)
Y.hat - predict(fit)
r - resid(fit)
data.df - as.data.frame(cbind(X,Y,W))
bs - function(data, indices) {
  Y.b - Y.hat + r[indices]
  fit.b - lm(Y.b ~ X - 1,weights=W)
  return(coef(fit.b))}
results - boot(data=data.df, statistic=bs,R=1000)

boot.ci(results, type=perc, index=1)

-- 
View this message in context: 
http://www.nabble.com/Bootstrap-CI-of-Slope-in-a-Weighted-Simple-Linear-Regression-tf4755456.html#a13598953
Sent from the R help mailing list archive at Nabble.com.

__
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] lm.boot function gives error

2007-10-29 Thread Tom La Bone

When I run this calculation

  library(ISwR)
  library(simple.boot)
  data(thuesen)
  fit - lm(thuesen$short.velocity~thuesen$blood.glucose)
  summary(fit)
  fit.sb - lm.boot(fit,R=1000,rows=F)
  summary(fit.sb)

I get the following error from the lm.boot routine:

  newdata' had 100 rows but variable(s) found have 24 rows

I don't know what this error means. Also, this example is not vastly
different than the one given in the simple.boot documentation and yet I
can't get it to run. Any suggestions? Thanks.

Tom

-- 
View this message in context: 
http://www.nabble.com/lm.boot-function-gives-error-tf4714183.html#a13475530
Sent from the R help mailing list archive at Nabble.com.

__
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.


Re: [R] In a SLR, Why Does the Hat Matrix Depend on the Weights?

2007-10-19 Thread Tom La Bone
Because it does. I should have looked ahead a few chapters in the book
before I asked the question. However, I can't seem to reproduce the values
of the hat matrix given by R for the weighted fit example I gave. Any
suggestions (other than looking ahead a few more chapters)?

 

Tom

 


[[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] Documentation for Pearson Residuals

2007-10-17 Thread Tom La Bone
Greetings,

 

I have been using lm to perform weighted linear regressions and resid to
extract the residuals. I happened upon some class notes on the internet that
described how one can specify type=pearson in resid to extract the
weighted residuals. Where is this option documented? And if you know that,
what is the best way to find such documentation if you don't know that the
option exists? Thanks for the advice.

 

Tom

 

 


[[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.