Question

I just loaded R to my windows machine and included bootstrap routines and the mcr routine for Deming regression. Very basic questions.

  1. How do I imbed Deming regression inside a bootstrap sampling routine?

  2. How do I input my data into R? The data is in an Excel spreadsheet.

Please try to give me a quick way. I am trying to do this today if possible!

Was it helpful?

Solution

For the long run you should really read the R Import/Export manual and the Introduction to R (both are installed when you install R).

For the short term, one simple approach is: Open the file using Excel and highlight the section that incudes the data of interest, including a first row that has the column names (if you start on the upper left cell and hold down both ctrl and shift then tap the down arrow, then the right arrow keys it may help with this process). Then right click on the selection and choose "copy".

In R type:

mydata <- read.delim('clipboard', header=TRUE)

If everything worked properly then mydata will now be a dataframe containing your data. If you type:

View(mydata)
summary(mydata)

Then you will get a spreadsheet like window of the data that you can examine (note the capitol "V" in "View") and a quick summary of the data that you can check to make sure that everything makes sense (no means for categorical data, means are computed for numeric data). If these summaries don't make sense, then we will need more detail on your data format.

You can then run the regression by doing something like:

library("mcr")
model1 <- mcreg(mydata$xvar, mydata$yvar, error.ratio=1, method.reg="Deming",
      method.ci="bootstrap")
printSummary(model1)
getCoefficients(model1)
plot(model1)

With xvar and yvar replaced with the appropriate variable names.

You will need to study up on the documentation if you want other options and on how to interpret the results, but this should get you started.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top