From 4f68aee8b22ef0e517ca266dd2b7249d8508a725 Mon Sep 17 00:00:00 2001 From: Julian Sagebiel <julian.sagebiel@idiv.de> Date: Thu, 25 Jul 2024 12:35:31 +0200 Subject: [PATCH] added ztest --- NAMESPACE | 1 + R/apollo_ztest.R | 13 ++++++++++++- man/apollo_ztest.Rd | 24 ++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 man/apollo_ztest.Rd diff --git a/NAMESPACE b/NAMESPACE index 7cb0032..bdaccf3 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,6 +1,7 @@ # Generated by roxygen2: do not edit by hand export("%>%") +export(apollo_ztest) export(createSets) export(poetest) export(quicktexregapollo) diff --git a/R/apollo_ztest.R b/R/apollo_ztest.R index bbe6511..3fbd3b6 100644 --- a/R/apollo_ztest.R +++ b/R/apollo_ztest.R @@ -1,6 +1,17 @@ -#z-test with apollo data + +#' Perform a z test to compare parameters from two models which were estimated with apollo +#' +#'Use this test if you estimate the exact same model with different data sets. For example, if you have a split sample and want to compare the two samples for differences in preferences. The test is especially useful for models in WTP Space where the Poe Test ist not adequate. +#' @param model1 Model from which to take the first parameter +#' @param model2 Model from which to take the second parameter +#' @param hyp Your hypotheses to test. Default is 0 which means you test for equality of parameters. Currently there are no other options. If you change the value, it will still test for equality (0) +#' +#' @return a dataframe with the test statistics +#' @export +#' +#' @examples \dontrun apollo_ztest(model1,model2) apollo_ztest <- function(model1, model2, hyp=0){ comp = data.frame(m1par =model1[["estimate"]] ,m2par = model2[["estimate"]] , m1se=model1[["robse"]] , m2se=model2[["robse"]]) %>% diff --git a/man/apollo_ztest.Rd b/man/apollo_ztest.Rd new file mode 100644 index 0000000..d82bd9e --- /dev/null +++ b/man/apollo_ztest.Rd @@ -0,0 +1,24 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/apollo_ztest.R +\name{apollo_ztest} +\alias{apollo_ztest} +\title{Perform a z test to compare parameters from two models which were estimated with apollo} +\usage{ +apollo_ztest(model1, model2, hyp = 0) +} +\arguments{ +\item{model1}{Model from which to take the first parameter} + +\item{model2}{Model from which to take the second parameter} + +\item{hyp}{Your hypotheses to test. Default is 0 which means you test for equality of parameters. Currently there are no other options. If you change the value, it will still test for equality (0)} +} +\value{ +a dataframe with the test statistics +} +\description{ +Use this test if you estimate the exact same model with different data sets. For example, if you have a split sample and want to compare the two samples for differences in preferences. The test is especially useful for models in WTP Space where the Poe Test ist not adequate. +} +\examples{ +\dontrun apollo_ztest(model1,model2) +} -- GitLab