1

I have programmed a Deming regression function in VBA for EXCEL. I want to test it but I cannot find a data set. What I find are R codes where the data sets are created, but since I don't know any R this does not help me. Could some one please point me at a data set.

Here is one example in R that I have found.

http://www.lithoguru.com/scientist/statistics/Deming%20Regression.R

I do not know if it is helpful as I don't know any R.

2
  • Can you please link the R data sets you’ve found. Exporting to excel should be simple. – philshem Nov 27 '20 at 20:34
  • I have edited my question. Good idea of simply using one of the examples that I have found. – Zorg Nov 27 '20 at 21:59
0

I pasted the code from the URL (archive) into RStudio and ran the code. It creates three vectors that, without much analyzing, seem to be input vectors: x, y, y_ideal:

x = seq(10,20,0.25)
y_ideal = x
N = length(x)
sd = 2
y = rnorm(N,y_ideal,sd)  # rnorm(n,mean,sd)

Actually y_ideal is just set to x., so really you should only need x and y:

The function rnorm() gives you a normal distribution with the variables:

  • N: number of observations

  • mean: vector of means

  • sd: vector of standard deviations

I then made a data.frame (aka "matrix") with the 3 vectors:

df <- data.frame(x,y,y_ideal)

a data frame can have an Excel-like view in RStudio:

enter image description here

and then exported it to a csv:

write.csv(df, 'deming.csv', row.names = FALSE)

which I'll put here for your convenience - and online

"x","y","y_ideal"
10,10.9277728455939,10
10.25,10.5933490961181,10.25
10.5,14.0852031368451,10.5
10.75,12.4232922691896,10.75
11,14.7683460256395,11
11.25,9.93532391180117,11.25
11.5,12.4777201750146,11.5
11.75,11.3343548513887,11.75
12,10.2801940515687,12
12.25,10.3694533979591,12.25
12.5,16.7670475398486,12.5
12.75,15.025087197753,12.75
13,15.747932175025,13
13.25,12.4146751515162,13.25
13.5,12.8150380193588,13.5
13.75,16.9127206628306,13.75
14,13.6818446843247,14
14.25,15.6428120655422,14.25
14.5,11.6094851517286,14.5
14.75,17.3868200845988,14.75
15,14.374938003457,15
15.25,16.5397831100747,15.25
15.5,16.5774828754729,15.5
15.75,16.0933165508874,15.75
16,14.0815845992991,16
16.25,16.1954498412194,16.25
16.5,20.62422023611,16.5
16.75,15.7032049193883,16.75
17,13.7508477699139,17
17.25,18.06073937896,17.25
17.5,19.8632816230287,17.5
17.75,18.1758896126998,17.75
18,18.1437515547828,18
18.25,18.5226369240186,18.25
18.5,15.8481144868907,18.5
18.75,20.3427101476114,18.75
19,21.6697499301055,19
19.25,21.7060773339034,19.25
19.5,20.6452923318518,19.5
19.75,17.1521716029471,19.75
20,17.6399835307955,20

The R script also generates this image:

enter image description here

and if you print dem.reg

> dem.reg@para
                EST        SE        LCI      UCI
Intercept 2.1266197 1.6300808 -1.1705300 5.423769
Slope     0.8943716 0.1066187  0.6787149 1.110028

Instructions for installing R and RStudio are here: https://rstudio.com/products/rstudio/download/#download

Here's what my screen looks like - you'll see RStudio has sort of a "Matlab" look and feel.

enter image description here

6
  • Thanks a lot for your efforts! I really appreciate it! – Zorg Nov 28 '20 at 12:44
  • sure thing. for the record, you should be able to generate this dataset easily with Excel: NORMDIST(x,mean,standard_dev,cumulative) support.microsoft.com/en-us/office/… – philshem Nov 28 '20 at 14:02
  • Thanks I know that but I needed a example with the result, so I can check if my code calculates right. – Zorg Nov 28 '20 at 15:15
  • One more question, sorry. Does the R code also teels yout the slope and the intercept? – Zorg Nov 30 '20 at 8:53
  • I added the output of printing dem.reg to the answer. – philshem Nov 30 '20 at 10:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.