[R] Package VIF

2013-04-17 Thread Jaap van Wyk


Hi

Could you perhaps possibly help me. I would like to use the package  
VIF but cannot get results


I attach the .csv file and my R code. What do I have to do ? Any help  
is greatly appreciated.


library(VIF)
coal - read.csv(e:/freekvif/cqa1.csv,header=TRUE)
y - as.numeric(coal$AI)
x - as.matrix(cbind(coal$Gyp, coal$Pyrite, coal$Sid, coal$Calcite,  
coal$Dol, coal$Apatite, coal$Kaol, coal$Quartz, coal$Mica, coal$Micro,  
coal$Rutile))

myd -list(y=y,x=x)
vif.sel - vif(myd$y, myd$x, subsize=11, trace=FALSE)
vif.sel$select

Response from R:
logical(0)

Thank you so much,
Jacob
__
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 needed with data format required for package VIF

2013-04-16 Thread Jaap van Wyk


Hallo

Could somebody perhaps assist with my dilemma,
Package: VIF. The examples are not very clear (data is stored internally).

I wish to read a .csv file (header=TRUE) and run VIF. But I get  
nonsensical output.

I have downloaded the boston.csv file (from the referring website).
How do I run the example using this file format directly (say, using  
read.table ??


Any help is greatly appreciated.

Regards
Jacob

__
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] Simulating distribution of max of two die

2011-08-29 Thread Jaap van Wyk

Hallo

I am teaching a very elementary intro course about R, and want to show  
the students how to find the distribution of the maximum of rolling  
two balanced die. Is there perhaps a more elegant way to do this,  
other than the way I am using below? (I would like to show them two  
ways - the one shown here, and perhaps and improved/elegant approach  
(showing off the beauty of R.

My code is as follows:

R n - 2
R d1 - sample(1:6, n, replace=TRUE)
R d2 - sample(1:6, n, replace=TRUE)
R d - apply(matrix(c(d1,d2), nrow=n, byrow=TRUE), 1, max)
R round(table(d)/n, 3)
d
1 2 3 4 5 6
0.030 0.084 0.137 0.195 0.246 0.308

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