0

I am using rucm package, I have a ucm class object called multivar_ucm. When I just type multivar_ucm in r console and hit enter I get the beta estimates of all exogenous variables along with standard error and p values printed in the r console.

I could get the beta coefficients by using as.data.frame(multivar_ucm$est) and write it in a csv file. Looking for a similar approach to export the respective p values as well.

zx8754
  • 52,746
  • 12
  • 114
  • 209
  • 1
    Welcome to StackOverflow! Please read the info about [how to ask a good question](http://stackoverflow.com/help/how-to-ask) and how to give a [reproducible example](http://stackoverflow.com/questions/5963269). This will make it much easier for others to help you. – zx8754 Jan 15 '18 at 13:35

1 Answers1

1

Unfortunately the package does not expose the object’s p-value (this is somewhat of an oversight). The print.ucm method recomputes the value every time. If you want to get the object’s p-value, you’ll need to do the same:

t_value = x$est / attr(x, "se")
p_value = 2 * pt(-abs(t_value), df = attr(x, "df"))

(Code cleaned up slightly.)

Konrad Rudolph
  • 530,221
  • 131
  • 937
  • 1,214