Search This Blog

Sunday, March 10, 2019

Curvilinear regression in R: a parabolic-model example

Simple linear regression (SLR) and multiple linear regression (MLR) analysis is frequently applied when modeling data. If your visual or statistical analysis during model building suggests
a relationship that is non-linear, you may want to try curvilinear modeling (polynomial modeling).
R programming for SLRMLR and curvilinear regression (CLR) analysis is very similar. CLR model building in R is done in four basis steps:
  1. Structure your data in a data frame, for example, via import from a CSV file.
  2. Calculate the desired powers for the independent variable(s) and add them to the data frame. 
  3. Derive the curvilinear model by using the lm() function.
  4. Review the results displayed with the summary() function.
In the case of a parabolic model (quadratic model), only square values need to be calculated and included in the data frame at step 2.

The derived model—if found to satisfactorily fit the data—can then be applied to estimate new values for the dependent variable (response values) by calling the predict() function, which needs to receive a data frame object with new values for the independent variables.

Find the tutorial-style documents and associated CSV files with example data for SLR, MLR and CLR modeling (parabolic modeling) with R in the following.

SLR modeling

Document: www.axeleratio.com/math/comp/linreg/linregways.pdf   
Data: www.axeleratio.com/math/comp/linreg/csv/woodward71.csv
 

MLR modeling

Document: www.axeleratio.com/math/comp/linreg/multilinreg.pdf   
Data: www.axeleratio.com/math/comp/linreg/csv/woodward82.csv

CLR modeling (parabolic modeling example)

Document: www.axeleratio.com/math/comp/linreg/curvilinreg.pdf   
Data:www.axeleratio.com/math/comp/linreg/csv/woodward83.csv



Example of curvilinear model building in R: details are given in my document “How to perform curvilinear regression analysis with R


Keywords: statictical analysis, linear modeling, non-linear modeling, machine learning, testing relationships, model building, R programming.

Tuesday, March 5, 2019

Multiple linear regression in the R software environment

Carrying out multiple linear regression (MLR) in the freely available R software environment is not very different from performing simple linear regression (SLR) in R. The same basic steps can be followed when working on a MLR problem:
  1. Structure your data in a data frame, for example, via import from a CSV file.
  2. Derive the linear model by using the lm() function.
  3. Review the results displayed with the summary() function.
The derived model can then be applied to estimate new values for the dependent variable (response values) by calling the predict() function, which needs to receive a data frame object with new values for the independent variables.

Data and code to get started with MLR in R:


CSV file with sample dataset at
www.axeleratio.com/math/comp/linreg/csv/woodward82.csv.

Tutorial-style document with title “How to perform multiple linear regression analysis with R” at
www.axeleratio.com/math/comp/linreg/multilinreg.pdf.

MLR in R using the woodward82.csv dataset as explained in the articleHow to perform multiple linear regression analysis

Wednesday, February 20, 2019

Simple linear regression with Python and R: Getting started

Linear modeling in R
Development of a linear model in R using physical property values of rubber samples. Explore the use of R for linear modeling in a detailed document.
Python and R are open-source programming languages. There is a large community of scientific software developers using Python and its NumPy and SciPy libraries. While Python is a general-purpose language, R programming mainly has its focus on statistical and predictive analysis. Both languages are currently popular choices in designing algorithms for big data problems and machine learning projects, but also are employed by researchers in diverse fields whenever the need arises for data fitting, complex calculations, simulations and modeling.

The evaluation of the the relationship between two variables is a frequently occurring task; for example, in calibrating measurement instruments and modeling experimental data. Here is a Getting Started document:  Simple linear regression with Python and R: three ways to begin with. Therein, linear modeling in Python and R is demonstrated and compared. You will learn how

  • to import CSV-formated data in Python and R ,
  • to use NumPy arrays in SLR computation,
  • to derive regression and correlation coefficients with SciPy's stats.linregress() function,
  • to use R's data.frame container with the lm() function to fit a linear model presenting your data.


Generation of scatter diagram in R
R instruction resulting into a scatter diagram for the rubber-sample data used in the linear model development
  
Keywords: linear regression, Python, R, statistical description, data analysis, machine learning.


Sunday, February 3, 2019

Threats or no threats? What is a harmful website?

The McAfee security scan is supposed to identify threats on and onto a computer [1]. Recently, I got a list of harmful websites, McAfee found after a scan. For example, the list included the following sites:


What does this mean? The last two sites in the list I don't recall visiting. The first two I visit frequently—like many of us do! So, I am not really expecting them to be a threat. Neither is my Trailingahead blog, hosted by Blogger, which is a Google service. 

I checked the URLs above with VirusTotal (www.virustotal.com/#/home/url). They came out clean. I didn't see flags or URL/domain blacklisting.

If McAfee finds a website it indicates as harmful, then—so goes the claim—the scanner has detected some evidence of misbehavior such as spamming, malware activity or a server problem [2]. But obviously this website-threat connection is not always true or, at least, not made transparent. There are people out there with the advice to ignore such “harmful website” warnings or even uninstall McAfee [3].

Now, I am not sure if this information was helpful? But I hope it was not harmful!


References


[1] Lynn Burbeck: How to Remove Threats Detected by McAdee. It Still Works. Link: https://itstillworks.com/remove-threats-detected-mcafee-8572308.html.
[2] What does it mean if McAfee scan finds an "issue" of "harmful website" for a site I visited in the past, but no other issues? Quora. Link: www.quora.com/What-does-it-mean-if-McAfee-scan-finds-an-issue-of-harmful-website-for-a-site-I-visited-in-the-past-but-no-other-issues.
[3] How do I get rid of a "Harmful Website" threat? Yahoo! Answers. Link: answers.yahoo.com/question/index?qid=20131218145638AA5JdP3.