Files
perl-Statistics-LineFit/perl-Statistics-LineFit.spec
2025-08-12 18:17:13 +02:00

89 lines
3.4 KiB
RPMSpec

#
# spec file for package perl-Statistics-LineFit
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define cpan_name Statistics-LineFit
Name: perl-Statistics-LineFit
Version: 0.70.0
Release: 0
# 0.07 -> normalize -> 0.70.0
%define cpan_version 0.07
License: Artistic-1.0 OR GPL-1.0-or-later
Summary: Least squares line fit, weighted or unweighted
URL: https://metacpan.org/release/%{cpan_name}
Source0: https://cpan.metacpan.org/authors/id/R/RA/RANDERSON/%{cpan_name}-%{cpan_version}.tar.gz
Source100: README.md
BuildArch: noarch
BuildRequires: perl
BuildRequires: perl-macros
Provides: perl(Statistics::LineFit) = 0.60.0
%undefine __perllib_provides
%{perl_requires}
%description
The Statistics::LineFit module does weighted or unweighted least-squares
line fitting to two-dimensional data (y = a + b * x). (This is also called
linear regression.) In addition to the slope and y-intercept, the module
can return the square of the correlation coefficient (R squared), the
Durbin-Watson statistic, the mean squared error, sigma, the t statistics,
the variance of the estimates of the slope and y-intercept, the predicted y
values and the residuals of the y values. (See the METHODS section for a
description of these statistics.)
The module accepts input data in separate x and y arrays or a single 2-D
array (an array of arrayrefs). The optional weights are input in a separate
array. The module can optionally verify that the input data and weights are
valid numbers. If weights are input, the line fit minimizes the weighted
sum of the squared errors and the following statistics are weighted: the
correlation coefficient, the Durbin-Watson statistic, the mean squared
error, sigma and the t statistics.
The module is state-oriented and caches its results. Once you call the
setData() method, you can call the other methods in any order or call a
method several times without invoking redundant calculations. After calling
setData(), you can modify the input data or weights without affecting the
module's results.
The decision to use or not use weighting could be made using your a priori
knowledge of the data or using supplemental data. If the data is sparse or
contains non-random noise, weighting can degrade the solution. Weighting is
a good option if some points are suspect or less relevant (e.g., older
terms in a time series, points that are known to have more noise).
%prep
%autosetup -n %{cpan_name}
find . -type f ! -path "*/t/*" ! -name "*.pl" ! -path "*/bin/*" ! -path "*/script/*" ! -path "*/scripts/*" ! -name "configure" -print0 | xargs -0 chmod 644
%build
perl Makefile.PL INSTALLDIRS=vendor
%make_build
%check
make test
%install
%perl_make_install
%perl_process_packlist
%perl_gen_filelist
%files -f %{name}.files
%doc Changes README Todo
%license LICENSE
%changelog