Mathatistics Blog on Mathatistics
/post/
Recent content in Mathatistics Blog on MathatisticsHugo -- gohugo.ioen-usTue, 31 Jan 2017 00:00:00 +0000Generate random and arbitrary data
/post/generate-random-and-arbitrary-data/
Sun, 30 Dec 2018 00:00:00 +0000/post/generate-random-and-arbitrary-data/Matrix of One (1) with specific dimension Julia Python R ones(Int64, (2, 3)) 2×3 Array{Int64,2}: 1 1 1 1 1 1 import numpy as np print(np.ones((2, 3), dtype="int")) [[1 1 1] [1 1 1]] matrix(1, 2, 3) [,1] [,2] [,3] [1,] 1 1 1 [2,] 1 1 1 Matrix of same arbitrary element with specific dimension Julia Python R fill(3.14, (2, 3)) 2×3 Array{Float64,2}: 3.Interpreting Biplot
/post/interpreting-biplot/
Sat, 18 Mar 2017 00:00:00 +0000/post/interpreting-biplot/Obviously, the name suggests itself that there are two aspect of data plotted in latent scale. Biplot in case of principal component analysis (PCA) plot both variable and observation in latent scale (scores and loadings). Throughout this article, I will use USArrests data from datasets package. Lets fit a PCA model using princomp function. However, this can also be done using prcomp. The later one uses singular value decomposition while the former one uses eigenvalue decomposition.Model assessment and variable selection
/post/model-assessment-variable-selection/
Sun, 05 Mar 2017 00:00:00 +0000/post/model-assessment-variable-selection/Whenever we add a variable in our model, we are not only adding information but also noise that clutter the information and makes the analysis difficult. Simpler model is always better since they contain less noise and they are easy to interpret. In real life, things are not that simple. But relax, there are statistical methods that make model assessment and perform variable selection and gives optimal set of variables for us.Basic Scatter Plot and linear fitted line
/post/basic-scatter-plot-with-reg-line/
Wed, 01 Mar 2017 00:00:00 +0000/post/basic-scatter-plot-with-reg-line/Lets scatter into some points created by data in xy-space. Data are scattered everywhere but what relation is there between some specific variable with other. Cutting down to simple talking and stick to the heading, we can use mtcars dataset in R.
The dataset from Motor Trend US magazine, 1974 comprises fuel consumption and 10 various aspects of automobile design and their performance for 32 automobiles of different models. I will try to obtain the scatter plot for the model and the fitted line for the model.Create LaTeX, HTML and Markdown tables in R
/post/latex-html-tables-in-r/
Wed, 01 Mar 2017 00:00:00 +0000/post/latex-html-tables-in-r/R can do data analysis and it can create beautiful reports. You can build all these documents directly in R using rmarkdown which is powered by powerful pandoc. In lots of occasions, user just wants to get some output format of tables that we can use in other platform such as Microsoft word, LaTeX, HTML or Markdown. Here I will discuss about some packages that helps us doing so including xtable, pander, knitr, stargazer and tables.Using Data from different Packages
/post/dataset-in-r/
Wed, 01 Mar 2017 00:00:00 +0000/post/dataset-in-r/Most of the time we need data either for teaching purpose or learning things. Whatever be the reason, data are really important things. R and different packages of R contains different datasets which we can use directly just by installing them. Many books related to R illustrate there examples using these data sources. We can find the dataset from differnt sources as data()
The datasets from the package datasets and other loaded packages is shown in default.LaTeX autocompletion in RStudio
/post/latex-autocomplete-rstudio/
Thu, 25 Feb 2016 00:00:00 +0000/post/latex-autocomplete-rstudio/When I was working on my Masters thesis, I needed the latex autocompletion feature in Rsudio, but could not find it anywhere. There is no option to create custom snippet either. But recently I found some basic and necessary auto-completion for latex is available in RStudio. Following are some of the these you want to use, but remember to press Shift + Tab for autocomplete. Further this will only work on sweave or knitr file only, which is pretty obvious.Scatter plot with multiple group
/post/scatter-plot-multple-group/
Tue, 12 Jan 2016 00:00:00 +0000/post/scatter-plot-multple-group/In many situations, it becomes essential to have a plot with multiple categories. For example, colour the scatter plot according to gender and have two different regression line for each of them.
Lets scatter the some points using data from mtcars, available default in R. Continuing the discussing from this post, where we had plotted mile per gallon (mpg) vs displacement (disp). Here we will create a separate regression line and colour the points accordingly based on number of cylinder (cyl) in the cars.