Everything you need to integrate X-Weight Pro into your research workflow, from quick start guides to advanced implementation patterns.
Get up and running with X-Weight Pro in under 5 minutes.
Sign up for a free developer account and obtain your API credentials.
curl -X POST https://api.xweight.pro/auth/register \
-H "Content-Type: application/json" \
-d '{"email": "your@email.com", "plan": "developer"}'
Choose your preferred programming language and install our SDK.
pip install xweight-pro
# or
conda install -c xweight xweight-pro
Run your first sample calibration with just a few lines of code.
from xweight import XWeightClient
client = XWeightClient(api_key="your_api_key")
# Load your data
result = client.calibrate(
sample_data="sample.csv",
constraints="constraints.json",
method="hybrid"
)
print(f"Calibration completed in {result.processing_time}s")
print(f"Sample efficiency: {result.efficiency}%")
Complete reference for all X-Weight Pro API endpoints and methods
Obtain an access token for API requests.
{
"api_key": "your_api_key",
"api_secret": "your_api_secret"
}
{
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...",
"token_type": "Bearer",
"expires_in": 3600
}
Submit a calibration job with sample data and constraints.
Parameter | Type | Required | Description |
---|---|---|---|
sample_data |
file/array | Yes | Sample data in CSV or JSON format |
constraints |
object | Yes | Demographic constraints and targets |
method |
string | No | Calibration method (default: "hybrid") |
bounds |
object | No | Weight boundaries {min: 0.1, max: 5.0} |
curl -X POST https://api.xweight.pro/v1/calibrate \
-H "Authorization: Bearer your_token" \
-H "Content-Type: application/json" \
-d '{
"sample_data": [...],
"constraints": {
"age_18_34": {"target": 0.25, "tolerance": 0.02},
"age_35_54": {"target": 0.35, "tolerance": 0.02},
"male": {"target": 0.48, "tolerance": 0.01}
},
"method": "hybrid",
"bounds": {"min": 0.3, "max": 3.0}
}'
{
"job_id": "cal_1234567890",
"status": "completed",
"results": {
"weights": [...],
"efficiency": 94.2,
"processing_time": 0.42,
"iterations": 7,
"convergence": true
},
"diagnostics": {
"weight_distribution": {...},
"constraint_satisfaction": {...}
}
}
Check the status of a calibration job.
Best practices and advanced implementation patterns for enterprise integration.
Proper data formatting is crucial for optimal calibration results.
{
"records": [
{
"id": "respondent_001",
"demographics": {
"age": 32,
"gender": "male",
"region": "northeast",
"education": "college"
},
"initial_weight": 1.0
}
]
}
{
"age_18_34": {
"target": 0.25,
"tolerance": 0.02,
"priority": "high"
},
"gender_male": {
"target": 0.48,
"tolerance": 0.01,
"priority": "critical"
}
}
Implement robust error handling for production systems.
try:
result = client.calibrate(data, constraints)
if result.convergence:
print(f"Success: {result.efficiency}% efficiency")
else:
print("Warning: Calibration did not fully converge")
except XWeightError as e:
if e.code == "INSUFFICIENT_DATA":
# Handle small sample size
pass
elif e.code == "CONFLICTING_CONSTRAINTS":
# Adjust constraints
pass
else:
# Log error and fallback
logger.error(f"Calibration failed: {e}")
Tips for optimizing calibration performance in high-volume environments.
Academic research and peer-reviewed publications on our methodology
The article studies estimating finite-population totals using auxiliary information via weight calibration: starting from design weights 1 / 𝜋 𝑘 1/π k , it seeks new weights that are as close as possible (under a chosen distance measure) to the originals while satisfying calibration equations that force weighted sums of auxiliaries to equal their known population totals. The GREG estimator arises naturally in this framework—efficient and precise...
In this article implements weight-calibration procedures known as iterative proportional fitting, or raking, of complex survey weights....
This paper proposes entropy balancing, a data preprocessing method to achieve covariate balance in observational studies with binary treatments...
Real-world examples and use cases for common calibration scenarios
import pandas as pd
from xweight import XWeightClient
# Initialize client
client = XWeightClient(api_key="your_api_key")
# Load sample data
sample_df = pd.read_csv("survey_data.csv")
# Define demographic constraints
constraints = {
"age_18_34": {"target": 0.25, "tolerance": 0.02},
"age_35_54": {"target": 0.35, "tolerance": 0.02},
"age_55_plus": {"target": 0.40, "tolerance": 0.02},
"gender_male": {"target": 0.48, "tolerance": 0.01},
"region_urban": {"target": 0.65, "tolerance": 0.03}
}
# Run calibration
result = client.calibrate(
data=sample_df,
constraints=constraints,
method="hybrid",
bounds={"min": 0.3, "max": 3.0}
)
# Apply weights to data
sample_df['final_weight'] = result.weights
print(f"Calibration efficiency: {result.efficiency}%")
Get help, share knowledge, and connect with other X-Weight Pro users
X-Weight Pro supports CSV, JSON, Excel, SPSS SAV, and Stata DTA formats. We also provide APIs for streaming data directly.
Our system can handle datasets with millions of records. Processing time scales linearly with sample size, typically 1-2 seconds per 100k records.
Yes, all data is encrypted in transit and at rest. We are SOC 2 Type II certified and comply with GDPR and other privacy regulations.
Yes, we offer enterprise on-premises deployments with dedicated support and custom SLA agreements.