[R] How to use S-Plus functions in R
Hi I am very new to R. I used to work in S-Plus a lot but that was years ago. I wrote a large number of functions that I now want to view and edit in R. I know I have to tell R where the functions are but I have no idea how. The functions are stored on my laptop's c-drive. I tried everything I could find e.g. library(myfilepath), source(myfilepath) etc. but nothing seems to work. Hein -- View this message in context: http://r.789695.n4.nabble.com/How-to-use-S-Plus-functions-in-R-tp3174963p3174963.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] PLS regression on near infrared (NIR) spectra data
Dear collegues, I´ ve worked with near infrared (NIR) spectroscopy to assess chemical, physical, mechanical and anatomical properties of wood. I use The Unscrambler software to correlate the matrix of dependent variables (Y) with the matrix of spectral data (X) and I would like to migrate to R. The matrix of spectral variables is very large (2345 columns and n lines, where n = samples), so we used Partial Least Squares Regression to predict a variable y (content of cellulose, for instance) based on the spectral variables, which are the NIR wavelengths. I am new here (since jan2009) and up to now, I not seen anyone commenting about principal component analysis and regression PLS to analyze spectral information in R system. Sorry, I am a R starter... Anybody have any package, or trick to suggest me? Grateful for yours information! -- Paulo Ricardo Gherardi Hein PhD candidate at University of Montpellier 2 CIRAD - PERSYST Department Research unit: Production and Processing of Tropical Woods - TA B-40/16 73 rue Jean-François Breton 34398 Montpellier Cedex 5, France phone: +33 4 67 61 44 51 skype: paulo_hein email: paulo.h...@cirad.fr [[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] Joint test
Dear All, I am estimating a Cox proportional hazard model, with several interactions of the type a*z + a*y + a*x + b*z + b*y + b*x. I need to know if the first three (the as) are jointly significantly different from the last three (the bs). I have tried several approaches, but have been unsuccessful. Here's the model, and the code I came up with, with the obvious shortcomings. modelPG2 - coxph(Surv(t0, t, d) ~ civilian + monarch + txmonarch + civwar + lngdpcap + growth + tropen4 + dopen4 + lnpop + age0 + entry1 + powtimes + initiator2 + defender2 + inherit + milwinsh + millosesh + mildrawsh + milwinwar + millosewar + mildrawwar + civwinsh + civlosesh + civdrawsh + civwinwar + civlosewar + civdrawwar + monwinsh + monlosesh + mondrawsh + monwinwar + monlosewar + mondrawwar + frailty(ccode), na.action=na.exclude, data=LeaderPG.data, control=coxph.control(eps=1e-09,iter.max=100,outer.max=100)) library(aod) # To test if Military Leaders are equally sensitive to the outcome of WAR as Civilian leaders we need a JOINT test. wald.test(b=coef(modelPG2), Sigma = vcov(modelPG2), Terms= c(19:21), H0=c(-2.9101, 2.4028, -1.6504)) #wald.test(b=coef(modelPG2), Sigma = vcov(modelPG2), Terms= c(19:21), H0=c(0, 2.4028, 0)) wald.test(b=coef(modelPG2), Sigma = vcov(modelPG2), Terms= c(25:27), H0=c(-8.2330,2.3041,-0.2626)) Any help would be very much appreciated. Hein Goemans. __ 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] Joint test
Dear All, I am estimating a Cox proportional hazard model, with several interactions of the type a*z + a*y + a*x + b*z + b*y + b*x. I need to know if the first three (the as) are jointly significantly different from the last three (the bs). I have tried several approaches, but have been unsuccessful. Here's the model, and the code I came up with, with the obvious shortcomings. modelPG2 - coxph(Surv(t0, t, d) ~ civilian + monarch + txmonarch + civwar + lngdpcap + growth + tropen4 + dopen4 + lnpop + age0 + entry1 + powtimes + initiator2 + defender2 + inherit + milwinsh + millosesh + mildrawsh + milwinwar + millosewar + mildrawwar + civwinsh + civlosesh + civdrawsh + civwinwar + civlosewar + civdrawwar + monwinsh + monlosesh + mondrawsh + monwinwar + monlosewar + mondrawwar + frailty(ccode), na.action=na.exclude, data=LeaderPG.data, control=coxph.control(eps=1e-09,iter.max=100,outer.max=100)) library(aod) # To test if Military Leaders are equally sensitive to the outcome of WAR as Civilian leaders we need a JOINT test. wald.test(b=coef(modelPG2), Sigma = vcov(modelPG2), Terms= c(19:21), H0=c(-2.9101, 2.4028, -1.6504)) #wald.test(b=coef(modelPG2), Sigma = vcov(modelPG2), Terms= c(19:21), H0=c(0, 2.4028, 0)) wald.test(b=coef(modelPG2), Sigma = vcov(modelPG2), Terms= c(25:27), H0=c(-8.2330,2.3041,-0.2626)) Any help would be very much appreciated. Hein Goemans. __ 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] Joint test
Dear John, Thank you very much. Yes, I think this should do it. The basic hypothesis is to test whether the outcome of war (win, lose, draw) has a different effect on different regime types. In other words, are leaders of some regime types more sensitive to the outcome of war than others. It seems to work great for one set of models, but I get an error message in another. I will try to figure this out. Thanks very much indeed for your help. Best, Hein. --On Friday, February 06, 2009 4:41 PM -0500 John Fox j...@mcmaster.ca wrote: Dear Hein, I'm not entirely sure that I understand what you want to do, but I think that you want to test that the coefficient of milwinwar equals that of civwinwar, and similarly and simultaneously for two other pairs of coefficients. If so, you should be able to use the linear.hypothesis() function in the car package: linear.hypothesis(modelPG2, c(milwinwar = civwinwar, millosewar = civlosewar, mildrawwar = civdrawwar)) You should be able to get the same test from the wald.test() function that you tried, but I believe that you would have to build the hypothesis matrix manually. I hope this helps, John -- John Fox, Professor Department of Sociology McMaster University Hamilton, Ontario, Canada web: socserv.mcmaster.ca/jfox -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Hein Goemans Sent: February-06-09 3:30 PM To: r-h...@stat.math.ethz.ch Subject: [R] Joint test Dear All, I am estimating a Cox proportional hazard model, with several interactions of the type a*z + a*y + a*x + b*z + b*y + b*x. I need to know if the first three (the as) are jointly significantly different from the last three (the bs). I have tried several approaches, but have been unsuccessful. Here's the model, and the code I came up with, with the obvious shortcomings. modelPG2 - coxph(Surv(t0, t, d) ~ civilian + monarch + txmonarch + civwar + lngdpcap + growth + tropen4 + dopen4 + lnpop + age0 + entry1 + powtimes + initiator2 + defender2 + inherit + milwinsh + millosesh + mildrawsh + milwinwar + millosewar + mildrawwar + civwinsh + civlosesh + civdrawsh + civwinwar + civlosewar + civdrawwar + monwinsh + monlosesh + mondrawsh + monwinwar + monlosewar + mondrawwar + frailty(ccode), na.action=na.exclude, data=LeaderPG.data, control=coxph.control(eps=1e-09,iter.max=100,outer.max=100)) library(aod) # To test if Military Leaders are equally sensitive to the outcome of WAR as Civilian leaders we need a JOINT test. wald.test(b=coef(modelPG2), Sigma = vcov(modelPG2), Terms= c(19:21), H0=c(-2.9101, 2.4028, -1.6504)) # wald.test(b=coef(modelPG2), Sigma = vcov(modelPG2), Terms= c(19:21), H0=c(0, 2.4028, 0)) wald.test(b=coef(modelPG2), Sigma = vcov(modelPG2), Terms= c(25:27), H0=c(-8.2330,2.3041,-0.2626)) Any help would be very much appreciated. Hein Goemans. __ 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.