Skip to content

Instantly share code, notes, and snippets.

View juliohm's full-sized avatar
🌎
Working from home

Júlio Hoffimann juliohm

🌎
Working from home
View GitHub Profile
@juliohm
juliohm / data.csv
Created February 6, 2018 03:30
Compositional data for GS240 - Homework 4
We can make this file beautiful and searchable if this error is corrected: It looks like row 6 should actually have 32 columns, instead of 11. in line 5.
x,y,Au,Ag,As,Ba,Be,Bi,Cd,Co,Cr,Cu,Mn,Nb,Ni,P,Pb,Rb,Sb,Sn,Ti,V,W,Zn,Zr,Si,Al,Fe,Mg,Ca,Na,K
28.09,28.306,0.8397,0.16358,12.557,640,2.566,0.41059,0.15289,10.268,54.98,19.511,586.6,14.133,24.322,578.3,39.246,115.4,1.1638,2.8783,3892.5,74.208,1.7011,68.816,321.2,6.393e+05,1.429e+05,41400,11700,15800,20200,29210
21.736,34.54,0.5309,0.097287,8.7926,610.4,2.4512,0.28667,0.11157,8.9944,48.4,17.046,543.9,11.779,19.467,598.1,23.337,110,0.78,2.287,3200.6,61.677,1.51,52.25,311.7,6.588e+05,1.224e+05,29800,12100,32800,25600,31230
30.464,26.078,2.6924,0.11951,14.807,535.3,2.4506,0.35381,0.10856,11.728,62.8,22.931,562.6,13.049,33.857,556,24.873,100.2,1.3248,2.32,3874.8,89.5,1.8328,65.283,254.6,5.702e+05,1.317e+05,49100,18100,48200,11100,23100
30.617,27.809,1.428,0.14994,15.708,565,2.4934,0.27281,0.15581,9.3256,50.9,16.907,466.8,10.346,21.71,786.3,28.206,104.8,0.91655,2.01,3111.5,63.4,1.4129,66.145,269.9,5.846e+05,1.354e+05,45900,17500,34700,13400,25100
0.76984,23.904,0.6721,0.06459,5.456,521.5,2.2487,0.2226,0.08863,5.5854,34.
@juliohm
juliohm / CoDaPFA.m
Last active February 6, 2018 16:31
Factor analysis for GS 240
function [B,L,var,fac,E,r,issuccess] = J_CoDaPFA(X,s)
% FA Factor analysis (principal factoring technique)
%
% The reason to favour this method opposite to maximum likelihood
% (Statistics toolbox) is no distributional assumptions. In comparison to
% SPSS program, this provides the same results. We expect identical
% numerical solution, especially advantage of singular value decomposition.
% Initial estimates of communalities are set as squared multiple
% correlations. In iteration process (convergence criterium 0.001, limit
% for iteration 75), communalities are set to one if Heywood case occurs.
@juliohm
juliohm / extreme_data.jl
Last active January 23, 2018 03:55
Extreme value datasets for GS 240
srand(2000) # make sure we get the same data
#############
# LOGNORMAL #
#############
using SpecialFunctions
# CDF and inverse CDF of standard normal
ϕ(x) = erfc(-x/√2) / 2