Simulation study - selecting p-value from simple lineair regression

Hi, we are conducting a Monte Carlo simulation study, but our team doesn't know how to select the p-value of the regression weight (in our case X1) from the regression test. After that, we will succeed in saving it in a dataframe.

This is a part of our draft-code: simresults$preg[sim] <- summary(lm(data$X2~data$X1))$p.value.
We suppose that the $p.value has to be changed, but we don't know how.

Thank you very much!

Try using

summary(lm(data$X2~data$X1))$coefficients[,4]
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.