I have a large data set with which I'm undertaking many regression analyses. I'm using a reduced major axis regression with r's lmodel2
package. What I need to do is extract the regression coefficients (r-squared, p-values, slope and intercept) from the RMA models. I can do this easily enough with the OLS regressions using:
RSQ<-summary(model)$r.squared
PVAL<-summary(model)$coefficients[2,4]
INT<-summary(model)$coefficients[1,1]
SLOPE<-summary(model)$coefficients[2,1]
And then export them in a .csv
export<-data.frame(RSQ,PVAL,INT,SLOPE)
write.csv(export, file="FILE_NAME.csv",row.names=F)
These commands don't seem to work for the lmodel2
regressions. Does anybody know how to do it?
Here is a small sample of the data:
x y
0.440895993 227.7
0.294277869 296.85
0.171754892 298.05
0 427.65
0.210884179 215.55
0.053238011 293.7
0.105395366 127.9
0.463933834 229.5
0 165.45
0.482128605 192.15
0.247341039 266.9
0 349.35
0.198833301 185.05
0.170786027 203.85
0.269818315 207.05
0.129543682 222.75
0.441665334 251.35
0 262.8
0.517974685 107.05
0.446336968 191.6
And the model II regression code I'm using
library(lmodel2)
data<-sample_data
mod_2<-lmodel2(y~x,data=data,"interval","interval",99)
mod_2