search for: numdat

Displaying 2 results from an estimated 2 matches for "numdat".

Did you mean: numdata
2013 Apr 01
2
example to demonstrate benefits of poly in regression?
Here's my little discussion example for a quadratic regression: http://pj.freefaculty.org/R/WorkingExamples/regression-quadratic-1.R Students press me to know the benefits of poly() over the more obvious regression formulas. I think I understand the theory on why poly() should be more numerically stable, but I'm having trouble writing down an example that proves the benefit of this. I
2010 May 17
1
suggestions/improvements for recoding strategy
...lution is below. I am curious about better approaches or any other suggestions. Thanks! # example input data myData <- read.table(textConnection("id, v1, v2, v3 a,1,2,3 b,1-2,,3-4 c,,3,4"),header=TRUE,sep=",") closeAllConnections() # the first column is IDs so remove that numdat <- myData[,-1] # function to change dashes: 1-2 to 1.5 myrecode <- function(mycol) { newcol <- mycol newcol <- gsub("1-2","1.5",newcol) newcol <- gsub("2-3","2.5",newcol) newcol <- gsub("3-4","3.5",newcol)...