# senseR-introduction

    library(senseR)

## Introduction

`senseR` is a statistical diagnostic tool designed to evaluate whether proxy indicators can reliably represent an underlying construct that cannot be directly observed or measured. It is intended for analytical diagnostics and policy-oriented assessment. Note that it does not perform causal inference.

## The `senser()` Function

The main function is senser(). It computes a diagnostic score for each proxy based on five components: Monotonicity – Spearman rank correlation between proxy and target. Information content – Proportion of variance explained (R-squared). Stability – Sensitivity of regression coefficients across subsamples. Distributional alignment – Similarity of standardized distributions via Kolmogorov–Smirnov test. Bias risk – Penalization for strong nonlinearity indicating potential proxy distortion.

The overall score is the average of these five components, ranging from 0 to 1: Suitable proxy: score >= 0.70 Conditionally suitable: 0.40 <= score < 0.70 Not suitable proxy: score < 0.40 Interpretation is automatically generated in English or Indonesian.

    # example
    set.seed(123)

    # Simulated dataset
    df <- data.frame(
      gdp = rnorm(100, 10, 2),
      ntl = rnorm(100, 50, 10),
      road_density = rnorm(100, 3, 0.5),
      mobile_signal = rnorm(100, 70, 15)
    )

    # Run senser in English
    senser(
      data = df,
      proxy = c("ntl", "road_density", "mobile_signal"),
      target = "gdp",
      lang = "english"
    )
    #>    target         proxy monotonicity information_content elasticity        cv
    #> X     gdp           ntl   0.00390039         0.002453434 0.04953215 0.1976486
    #> X1    gdp  road_density   0.12232823         0.016686441 0.12917601 0.1551972
    #> X2    gdp mobile_signal   0.09872187         0.001942958 0.04407900 0.2243373
    #>    avg_change ceiling_ratio stability_score final_score     classification
    #> X  11.2733208     0.5936694       0.0000000   0.3000000 Not suitable proxy
    #> X1  0.5081511     0.7380208       0.3952459   1.0000000     Suitable proxy
    #> X2 18.5465958     0.6397297       0.7629491   0.7629491     Suitable proxy
    #>                                                        interpretation
    #> X                     Proxy lacks sufficient statistical reliability.
    #> X1 Proxy demonstrates adequate variability and statistical stability.
    #> X2 Proxy demonstrates adequate variability and statistical stability.

    # Indonesian language support
    senser(
      data = df,
      proxy = c("ntl", "road_density"),
      target = "gdp",
      lang = "indonesia"
    )
    #>    target        proxy monotonicity information_content elasticity        cv
    #> X     gdp          ntl   0.00390039         0.002453434 0.04953215 0.1976486
    #> X1    gdp road_density   0.12232823         0.016686441 0.12917601 0.1551972
    #>    avg_change ceiling_ratio stability_score final_score    classification
    #> X  11.2733208     0.5936694       0.0000000         0.3 Proxy tidak layak
    #> X1  0.5081511     0.7380208       0.3952459         1.0       Proxy layak
    #>                                              interpretation
    #> X                 Proxy tidak cukup andal secara statistik.
    #> X1 Proxy memiliki variabilitas dan stabilitas yang memadai.

## Notes

Output is printed to the console; the function does not return a value invisibly. Designed for applied diagnostics and policy assessment. Always compare multiple proxies to select the most reliable indicators.

## References

Elbers, C., Lanjouw, J. O., & Lanjouw, P. (2003). Micro-level estimation of poverty and inequality. Econometrica. Henderson, J. V., Storeygard, A., & Weil, D. N. (2012). Measuring economic growth from outer space. American Economic Review.