[R] Help with Tinn-R

2010-06-09 Thread Van Wyk, Jaap
I have just installed the latest versions of R and Tinn-R (running Windows XP 
prof.)
R 2.11.0
Tinn-R version 2.3.5.2
Everything seems fine, except for the following:
I usually do this: Open Tinn-R and click on the R icon to open R - this splits 
the screen into two parts horiozontally, with Tinn-R on top and R in the bottom 
window.
My problem is simply this:
By highlighting one line, and click the "send line to R" icon, all works well.
But if I highlight more than 1 line and click the "send selection to R" icon, 
it does not work.\I get the following response and error message displayed in R:

R> source(.trPaths[5], echo=TRUE, max.deparse.length=150)
Error in source(.trPaths[5], echo = TRUE, max.deparse.length = 150) :
  object '.trPaths' not found
Can somebody please help me solve this.

Thank you so much for your time.

Regards
Jacob



Jacob L van Wyk, Dept. of Statistics, University of Johannesburg (APK),
Box 524, Auckland Park, 2006, South Africa
Office: +27 11 559 3080, Fax: +27 11 559 2499



This email and all contents are subject to the following disclaimer:

http://disclaimer.uj.ac.za

[[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] Proxy settings

2010-02-11 Thread Van Wyk, Jaap
Thanks, especially to Greg for the help with the proxy settings required for 
Windows.
I have managed to solve the problem, with Greg's latest suggestion.
Jacob


Jacob L van Wyk
Department of Statistics
University of Johannesburg (APK)
PO Box 524, Auckland Park, 2006
Office ph: 011 559 3080
Fax: 011 559 2499



This email and all contents are subject to the following disclaimer:

http://www.uj.ac.za/UJ_email_legal_disclaimer.htm

[[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] Installation require proxy settings (2)

2010-02-10 Thread Van Wyk, Jaap
Hi
Thanks again to Greg, and Prof Ripley.
Greg, I was trying to send you an email, but has been unsuccessful.
Speaking to someone from our IT deparment, I am trying to follow your advice to 
implement the settings to my computer (using Windows), by using Control Panel.
I have selected System in Control Panel and chose System, Advanced tab, 
Environmental Variables, and created the user variables:
http_proxy, with value 152.106.241.34:3128
http_proxy_user, with value user:pass (replacing these with my own username and 
password to connect to the internet via Internet Explorer.
I have deleted R, rebooted the computer, and installed R again (NOT choosing 
Internet2).
Then after opening Rgui.exe, I go to the Packages menu in the R console, and 
select  "Set CRAN mirror". I choose one, but the R comes back with the 
following:
R> chooseCRANmirror()
Error in m[, 1L] : incorrect number of dimensions

Could you possibly think of a fix for this problem? (Maybe I should try setting 
System variables?)

Thanks
Jacob


Jacob L van Wyk
Department of Statistics
University of Johannesburg (APK)
PO Box 524, Auckland Park, 2006
Office ph: 011 559 3080
Fax: 011 559 2499



This email and all contents are subject to the following disclaimer:

http://www.uj.ac.za/UJ_email_legal_disclaimer.htm

[[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] Installation require proxy settings (continued)

2010-02-08 Thread Van Wyk, Jaap
Thanks to Greg and Michael for their advice.
I have tried all these possibilities (and other); nothing seems to work; I 
persistently get the message:
In open.connection(con, "r") :
  cannot open: HTTP status was '407 Proxy Authentication Required'
It seems as if "proxy authentication required" is causing the problem.
It seems I have to set up an .Renviron file, but I am still learning R, and 
cannot find such a file.
Would it help, and how do I create it (it that is a possible alternative to 
try).
Thanks for any comments.
Jacob


Jacob L van Wyk
Department of Statistics
University of Johannesburg (APK)
PO Box 524, Auckland Park, 2006
Office ph: 011 559 3080
Fax: 011 559 2499



This email and all contents are subject to the following disclaimer:

http://www.uj.ac.za/UJ_email_legal_disclaimer.htm

[[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] R installation require proxy setting

2010-02-08 Thread Van Wyk, Jaap
Could somebody please assist with the problem I have now.
At our university certain changes have been made to users regarding accessing 
the internet.
I have re-installed the (current) version of R, using custom settings (for 
Windows XP), choosing amongst other things "Internet2" somewhere.
Now, when I wish to install new packages, I first have to select a CRAN mirror.
R gives me a list to choose a mirror. But after choosing the mirror, R comes 
back with the following:

R> chooseCRANmirror()
Warning message:
In open.connection(con, "r") :
  cannot open: HTTP status was '407 Proxy Authentication Required'

I need to tell R that I need a proxy server, and give my proxy settings (how I 
log onto the server to connect to the Internet.

My question is: Where/how do I set this?

Any advice is much appreciated.

Thank you.

Jacob L van Wyk
Department of Statistics
University of Johannesburg (APK)
PO Box 524, Auckland Park, 2006
Office ph: 011 559 3080
Fax: 011 559 2499



This email and all contents are subject to the following disclaimer:

http://www.uj.ac.za/UJ_email_legal_disclaimer.htm

[[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] The Claw Density and LOCFIT

2009-06-26 Thread Van Wyk, Jaap
I am trying to reproduce Figure 10.5 of Loader's book: Local Regression and 
Likelihood. The code provided in the book does not seem to work.
I have managed (a while ago) to get the accompanied R-code for the figures in 
the book (file called lffigs.R) from somewhere - cannot find it on the web 
anymore. The code in the .R script file does not work either.
Could anybody please direct me in finding an updated version of this document, 
or help me correct the code given in the file. The (out-of-date) code is as 
follows:

   data(claw54)
  fit1 <- locfit( ~ claw54, deg = 0, kern = "gauss", alpha = c(0, 0.315), ev =
grid(100, ll = -3.5, ur = 2.7))
  fit2 <- locfit( ~ claw54, deg = 0, kern = "gauss", alpha = c(0, 0.985), ev =
grid(100, ll = -3.5, ur = 2.7))
  x <- seq(-3.5, 2.7, length.out = 200)
  y <- dnorm(x, -1., 0.1) + dnorm(x, -0.5, 0.1) + dnorm(x, 0, 0.1) + dnorm(x,
0.5, 0.1) + dnorm(x, 1., 0.1)
  y <- (y + 5 * dnorm(x))/10
  plot(fit1, get.data = T, main = "h=0.315", ylim = c(0, max(y)))
  lines(x, y, lty = 2)
  plot(fit2, get.data = T, main = "h=0.985", ylim = c(0, max(y)))
  lines(x, y, lty = 2)

THANKS FOR ANY ASSISTANCE.
ps: This code differs from that in the book. I have tried both, without 
success. Even if I just use, for example,
fit1 <- locfit( ~ claw54, deg = 0, kern = "gauss", alpha = c(0, 0.315))
I do not get the same result.

Jacob L van Wyk, Dept. of Statistics, University of Johannesburg (APK),
Box 524, Auckland Park, 2006.
Office: +27 11 559 3080, Fax: +27 11 559 2499



This email and all contents are subject to the following disclaimer:

http://www.uj.ac.za/UJ_email_legal_disclaimer.htm

[[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] Studentized intervals

2009-06-12 Thread Van Wyk, Jaap
I am trying to find studentized bootstrap intervals for the skewness of a data 
set. I have tried the following (nerve.dat is a set of data containing 
observations on one variable) (using Windows XP):

x <- scan("e:/Flashbackup2009/Nonparametrics/nerve.dat")
n <- length(x)
library(e1071)
skewness(x)
library(boot)
sampleskew <- function(x,d) {return(skewness(x[d]))}
bb <- boot(x,sampleskew,R=1000)
boot.ci(bb)


This gives four intervals (Normal, Basic, Percentile, BCa)
But gives the following warning message:

Warning message:
In boot.ci(bb, type = "all") :
  bootstrap variances needed for studentized intervals
The questions is: Why does the function not provide the bootstrap variances (or 
estimates thereof) for computing the studentized intervals?
Another question: How then can I compute the studentized intervals without 
physically doing a double bootstrap. Does the function use a "nonparametric 
delta mathod"?

Any help is much appreciated. I have probably overlooked something?

Thank you.
Jacob


Jacob L van Wyk, Dept. of Statistics, University of Johannesburg (APK),
Box 524, Auckland Park, 2006.
Office: +27 11 559 3080, Fax: +27 11 559 2499



This email and all contents are subject to the following disclaimer:

http://www.uj.ac.za/UJ_email_legal_disclaimer.htm

[[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] Graphics: Improving a Lattice plot - can it be done ?

2008-09-03 Thread Van Wyk, Jaap
Hallo all
 
I realise this might be a "too much to ask" question, but can I improve the 
Lattice plot produced by the following code? The type of figure I would like to 
produce in each segment of the plot appears below the code.
 
library(reserving)  # http://toolkit.pbwiki.com/RToolkit 
 
data(GenIns)
GenInsInc <- incrementalTriangle(GenIns)
basicCL <- ChainLadder(GenIns, quarterly=FALSE, usetail=FALSE, YOA=c(1997:2006))
# lattice plot by underwriting years
plot(basicCL, byYOA=TRUE)
 
Instead of the ordinary "confidence bands" produced by the re lines, I would 
like to display a type of "funnel", as illustrated in the code below:
 
funnelGraph <- function(x, ylim, bands, ...)
{
  #--
  # Function to plot a funnel graph
  # Requires package: RColorBrewer
  #
  # Created by Nigel De Silva, 3 June 2006
  # [EMAIL PROTECTED]  
  #--
  require(RColorBrewer)
  # Determine confidence levels for graph
  if(missing(bands)) bands <- 40
  ci <- seq(from=0.50, to=0.995, length=bands)
  q <- c(0.5-ci/2, 0.5+ci/2)
  # Calculate points to plot
  central <- apply(x, 2, mean)
  areas <- apply(x, 2, quantile, q)
  time <- 1:dim(x)[2]
  # Set up plot
  if(missing(ylim))
ylim = range(pretty(range(areas)))
  plot(time, central, ylim=ylim, type="n", ...)
  # Draw areas
  mypalette <- c(rev(brewer.pal(9, "Blues")), "White") #9 is max no of colours
  mypalette <- colorRampPalette(mypalette, space="Lab", bias=0.25)
  mypalette <- mypalette(bands)
  for(i in rev(1:length(ci))){
x <- c(time, rev(time))
y <- c(areas[i, ], rev(areas[i + length(ci), ]))
polygon(x, y, col=mypalette[i], border=NA)
  }
  # Draw mean path
  lines(time, central, lwd=2, col=2)
  return(time)
}
library(MASS)
assets <- mvrnorm(1, rep(0.05, 5), diag(rep(0.08, 5)))
assets <- exp(cbind(0, assets))
assets <- t(apply(assets, 1, cumprod))
funnelGraph(assets, xlab="Year", main="Projected Assets")
 
Thanks for any help!
Regards
Jacob
 
 
Jacob L van Wyk
Dept of Statistics
University of Johannesburg
P O Box 524
Auckland Park 2006
South Africa
Tel: +27-11-559-3080
Fax: +27-11-559-2499
Cell: +27-82-859-2031

[[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] Simple estimate of a probability by simulation (sender)

2008-08-20 Thread Van Wyk, Jaap
Thank you for all the responses!
It turned out that my "theory" contained an error - the answer is 0.2544, and 
this was confirmed with the simulation in R.
My students will be impressed - and I will quote where I found the great help.
 
Regards
Jacob
 
 
 
Jacob L van Wyk
Dept of Statistics
University of Johannesburg
P O Box 524
Auckland Park 2006
South Africa
Tel: +27-11-559-3080
Fax: +27-11-559-2832
Cell: +27-82-859-2031

[[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] Simple estimate of a probability by simulation

2008-08-20 Thread Van Wyk, Jaap
Hallo
 
I would appreciate any help with the following. 
Problem: Suppose A, B and C are independent U(0,1) random variables. What is 
the probability that A(x^2) + Bx + C has real roots?
I have done the theoretical work and obtained an answer of 1/9 = 0..
Now I want to show my students to get this in R with simulation.
Below are two attemps, both giving the answer to be about 0.26.
 
Could anybody please help me with providing a more elegant way to do this? (I 
am still learning R and trying to get my students to learn it as well. I know 
there must be a better way to get this.) I must be doing something wrong ?
 
n <- 1
### Method 1 ###
cnt <- rep(0,n)
for (i in (1:n)) {
   a <- runif(1)
   b <- runif(1)
   c <- runif(1)
   cnt[i] <- ifelse(((b^2)>4*a*c),1,0)
}
sum(cnt)/n
### Method 2 ###
one.s <- function(x) {
  ret <- ifelse(((x[2]^2) > 4 * x[1] * x[3]),1,0)
  ret
}
m <- cbind(runif(n),runif(n),runif(n))
sum(apply(m,1,one.s))/n
##
 
THANK YOU.
Jacob L van Wyk
Dept of Statistics
University of Johannesburg
P O Box 524
Auckland Park 2006
South Africa
Tel: +27-11-559-3080
Fax: +27-11-559-2832
Cell: +27-82-859-2031

[[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] gam.check in gam (mgcv)

2008-08-19 Thread Van Wyk, Jaap
Hallo
I need some help with the output provided by gam.check after a gam fit (using 
the package mgcv).
To give a brief description of my data, I have
claims: a vector of values, which include NA's and one large negative value - 
otherwise all positive (55 values in total that are not NA).
origin: a factor with 10 levels
j : taking the values 1, 2, , 10
I have fitted a gam, with:
 
> library(mgcv)
> modelg <- gam(claims ~ origin + s(log(col)), family = quasipoisson(),
 +  subset=!is.na(claims))
 
(I have obtained a work-around of the quasipoisson family to deal with the 
negative value.)
 
After this I tried the following:
 
> gam.check(modelg)
 
This gives a plot in the usual way (that looks fine, except for the "outlier" 
which was a negative value), but returns the following message:
 
fit method: deviance based outer iter. - newton, exact hessian.
step failed after 1 iteration.
gradient range [9.136047,9.136047] (score 994.1401 & scale 733.0711).
Hessian positive definite, eigenvalue range [42.98903,42.98903].

What does this mean? Is there a problem?
 
Any help is much appreciated.
 
Thanks.
Jacob L van Wyk
Dept of Statistics
University of Johannesburg
P O Box 524
Auckland Park 2006
South Africa
Tel: +27-11-559-3080
Fax: +27-11-559-2832
Cell: +27-82-859-2031

[[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 with matrix

2008-07-25 Thread Van Wyk, Jaap
Hi
I have 3 vectors, say g1, g2 and f, where g1 and g2 contain the row and column 
indices of a matrix, with corresponding elements in f. How can I create a 
matrix containing the values in f ?
For example:
g1  g2  f
3   4  10
2   1  30
4   4  50
How can then get a matrix that looks as follows:
 0   0   0   0
30  0   0   0
 0   0   0   10
 0   0   0   50
 
I am still learning R. I think reshape will help, but it is not clear how that 
works here.
 
Any help is much appreciated.
Thank you.
Jacob
 
 
Jacob L van Wyk
Department of Statistics
University of Johannesburg, APK
Box 524
Auckland Park 2006
South Africa
Office Tel: +27 11 559 3080
Fax: +27 11 559 2832
 

[[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 with rep

2008-07-25 Thread Van Wyk, Jaap
Hi
Is it possible to use the rep command (or maybe some other "shortcut") to 
create a vector with the following format:
4  3  4  2  3  4  1  2  3  4
 
Any help is much appreciated.
Thanks
Jacob
 
 
Jacob L van Wyk
Department of Statistics
University of Johannesburg, APK
Box 524
Auckland Park 2006
South Africa
Office Tel: +27 11 559 3080
Fax: +27 11 559 2832
 

[[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] R version 2.7.1 (warnings)

2008-07-20 Thread Van Wyk, Jaap
Thanks, Mark, for the response.
The problem is vith SciViews. It is not stable under the latest version of R.
I found a solution by downloading the latest version of Tinn-R, which 
communicates with the latest version of R, and now I can carry on like normal 
(with both windows tiled horizontally).
 
Jacob
 
 
Jacob L van Wyk
Department of Statistics
University of Johannesburg, APK
Box 524
Auckland Park 2006
South Africa
Office Tel: +27 11 559 3080
Fax: +27 11 559 2832
 

[[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] R version 2.7.1 (warnings)

2008-07-19 Thread Van Wyk, Jaap
Hi
I have installed the new version 2.7.1, and get the following messages. Is 
there some way I can "fix it" ?
I use SciViews as well, so the problem may be with one of the libraries that is 
loaded at start-up:
 
Start-up:
Loading required package: datasets
Loading required package: utils
Loading required package: grDevices
Loading required package: graphics
Loading required package: stats
Loading required package: tcltk
Loading Tcl/Tk interface ... done
Loading required package: R2HTML
Loading required package: svMisc
Loading required package: svIO
Loading required package: svViews
During startup - Warning message:
'Sys.putenv' is deprecated.
Use 'Sys.setenv' instead.
See help("Deprecated") 

What should I do to get rid of the warning message?
 
Next, after loading some data in the usual way and making a simple plot, I get 
the following:
Warning message:
'length(rescale)' differs between new and previous
 ==> NOT changing 'rescale' 
(This also happens at some other times, doing other things.)
 
Please help.
Thank you.
 
Jacob L van Wyk
Department of Statistics
University of Johannesburg, APK
Box 524
Auckland Park 2006
South Africa
Office Tel: +27 11 559 3080
Fax: +27 11 559 2832
 

[[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] GAMs

2008-03-21 Thread Van Wyk, Jaap
Hi
I have been searching for goodness-of-fit tests (or lack of fit tests) for GAMs 
and cannot find anything.
My problem is: after fitting a GAM to mortality data (smoothing crude estimated 
rates of mortality - a process called graduation in the actuarial literature), 
(1) how to assess the fit of the model with reference to "adherence to data" 
for the fitted model (I do not think the "usual" chi-square test is 
appropriate), and (2) compare the model to other models (parametric or 
non-parametric models).
Could anyone please provide some assistance.
Greatly appreciated.
Thanks
Jacob
 
Jacob L van Wyk
Department of Statistics
University of Johannesburg, APK
Box 524
Auckland Park 2006
South Africa
Office Tel: +27 11 559 3080
Fax: +27 11 559 2832
 

[[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] GAMs

2008-03-21 Thread Van Wyk, Jaap
Hi
I have been searching for goodness-of-fit tests (or lack of fit tests) for GAMs 
and cannot find anything.
My problem is: after fitting a GAM to mortality data (smoothing crude estimated 
rates of mortality - a process called graduation in the actuarial literature), 
(1) how to assess the fit of the model with reference to "adherence to data" 
for the fitted model (I do not think the "usual" chi-square test is 
appropriate), and (2) compare the model to other models (parametric or 
non-parametric models).
Could anyone please provide some assistance.
Greatly appreciated.
Thanks
Jacob
 
 
Jacob L van Wyk
Department of Statistics
University of Johannesburg, APK
Box 524
Auckland Park 2006
South Africa
Office Tel: +27 11 559 3080
Fax: +27 11 559 2832
 

[[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 with "old" function in "base"

2007-09-28 Thread Van Wyk, Jaap
Hi

I think there was a built-in function (perhaps C-code) called
"band_den_bin" in the base library (used for kernel density estimators).

Is there a newer version of this function. I have an old routine using
this but it won't run in the newer version of R.

Any help is much appreciated.

Jacob

 

 

Jacob L van Wyk

Dept of Statistics

University of Johannesburg, APK Campus

Box 524

Auckland Park 2006

South Africa

 


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